Re: 2.2pre1 crashes with partition check

Jens Axboe (axboe@image.dk)
Fri, 01 Jan 1999 22:28:58 +0100


"Brent M. Smith" wrote:
>
> Ok, It may be me, but this looks a little redundant.
>
> - if ((drive = get_info_ptr(i_rdev)) == NULL || drive->forced_geom)
> + drive = get_info_ptr(i_rdev);
> + if (!drive)
> + return 0;
> +
> + if (drive->forced_geom) {
> + /* bombs otherwise /axboe */
> + if (drive == NULL)
> + return 0;
>
> It looks like "drive" is being checked as a NULL pointer twice,
> Once after it's a assigned a value, and then once again within the
> "if" condition block. Is there a reason for this? I know axboe posted
> the fix inside the condition, but the "if (!drive) { return 0; }" was
> added also...
>
> Please excuse me if I'm missing something really obvious.
> I'm still trying to catch up on the mailing list, so I may
> have overlooked something.

No you're absolutely right. The confusion is caused by me sending the
first patch which was altered to move the check out of the if clause
for clarity. Somehow it got mixed up. test1-pre3 has the problem
code cleared up.

-- 
*  Jens Axboe <axboe@image.dk>
*  Linux CD-ROM Maintainer
* "The only thing that interferes with my
*  learning is my education." -- A. Einstein

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/