2002-11-30 16:08:55

by J.A. Magallon

[permalink] [raw]
Subject: [BUG] ext3-orlov for 2.4

HI all...

Tell me if this is correct. GCC-3.2 spits a wrning like this when
building -jam, I did not noticed before:

ialloc.c: In function `ext3_new_inode':
ialloc.c:546: warning: comparison between pointer and integer
ialloc.c:682: warning: label `out' defined but not used
ialloc.c:520: warning: `gdp' might be used uninitialized in this function

Line is question is:
if (gdp == -1)
goto fail;
It comes from the orlov-allocator for ext3.

Looking at the structure of ext3_new_inode:

struct inode * ext3_new_inode (handle_t *handle, struct inode * dir, int mode)
{
...
struct ext3_group_desc * gdp;

repeat:
...
if (gdp == -1)
goto fail;
...
gdp = ext3_get_group_desc (sb, group, &bh2);
...

Thigs to note:
- gdp is used without previous initialization.
- gdp is a pointer and is compared with -1

Should not the structure be:
gdp = ext3_get_group_desc (sb, group, &bh2);
if (!gdp)
goto fail;

Can anybody check 2.5 for this also ?

???

TIA

--
J.A. Magallon <[email protected]> \ Software is like sex:
werewolf.able.es \ It's better when it's free
Mandrake Linux release 9.1 (Cooker) for i586
Linux 2.4.20-jam0 (gcc 3.2 (Mandrake Linux 9.1 3.2-4mdk))


2002-11-30 22:06:22

by Andrew Morton

[permalink] [raw]
Subject: Re: [BUG] ext3-orlov for 2.4

"J.A. Magallon" wrote:
>
> HI all...
>
> Tell me if this is correct. GCC-3.2 spits a wrning like this when
> building -jam, I did not noticed before:
>
> ialloc.c: In function `ext3_new_inode':
> ialloc.c:546: warning: comparison between pointer and integer
> ialloc.c:682: warning: label `out' defined but not used
> ialloc.c:520: warning: `gdp' might be used uninitialized in this function
>
> Line is question is:
> if (gdp == -1)
> goto fail;
> It comes from the orlov-allocator for ext3.

gdp will be NULL on failure. The above code isn't right.

> Should not the structure be:
> gdp = ext3_get_group_desc (sb, group, &bh2);
> if (!gdp)
> goto fail;

yes.

> Can anybody check 2.5 for this also ?
>

Is OK.