Re: [Ext2-devel] Re: [PATCH] use-before-uninitialized value in ext3(2)_find_ goal

From: Chris Wright
Date: Fri May 21 2004 - 20:01:15 EST


* Matthew Wilcox (willy@xxxxxxxxxx) wrote:
> On Wed, May 19, 2004 at 12:53:28PM -0700, Chris Wright wrote:
> > I know it's a slightly bigger patch, but would it make sense to just enforce
> > this as part of api? Just a thought...(patch untested)
>
> No, that doesn't work. Look:
>
> reread:
> ...
>
> if (ext2_find_goal(inode, iblock, chain, partial, &goal) < 0)
> goto changed;
>
> changed:
> while (partial > chain) {
> brelse(partial->bh);
> partial--;
> }
> goto reread;
>
> So it's spaghetti code that can modify goal. Yuck.
>
> 5 labels in one function? 3 backwards jumps? Disgusting.

Heh, yeah. I actually did look, and had the same concern about goal.
I think it's ok though. For one thing, in that changed->reread loop
goal is never used. Secondly, I think that the intention was to have
*_find_goal start from 0, not from last goal, since goal is marked as
output, and Mingming's patch reset goal to 0 every pass through. This
is exactly why I thought it useful to clarify the api.

thanks,
-chris
--
Linux Security Modules http://lsm.immunix.org http://lsm.bkbits.net
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/