public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [BUG] ext3-orlov for 2.4
@ 2002-11-30 16:16 J.A. Magallon
  2002-11-30 22:13 ` Andrew Morton
  0 siblings, 1 reply; 2+ messages in thread
From: J.A. Magallon @ 2002-11-30 16:16 UTC (permalink / raw)
  To: Lista Linux-Kernel; +Cc: Andrew Morton, hugang

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 <jamagallon@able.es>      \                 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))

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [BUG] ext3-orlov for 2.4
  2002-11-30 16:16 [BUG] ext3-orlov for 2.4 J.A. Magallon
@ 2002-11-30 22:13 ` Andrew Morton
  0 siblings, 0 replies; 2+ messages in thread
From: Andrew Morton @ 2002-11-30 22:13 UTC (permalink / raw)
  To: J.A. Magallon; +Cc: Lista Linux-Kernel, hugang

"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.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2002-11-30 22:06 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-11-30 16:16 [BUG] ext3-orlov for 2.4 J.A. Magallon
2002-11-30 22:13 ` Andrew Morton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox