[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20120910163558.GA11282@andromeda.usersys.redhat.com>
Date: Mon, 10 Sep 2012 13:35:58 -0300
From: Carlos Maiolino <cmaiolino@...hat.com>
To: linux-ext4@...r.kernel.org
Subject: Re: [PATCH] ext4: fix possible non-initialized variable
> I'm afraid this doesn't fix it. So now err is init to 0, but then:
>
> err = ext4_map_blocks(handle, inode, &map,
> create ? EXT4_GET_BLOCKS_CREATE : 0);
>
> so err is immediately reset to whatever ext4_map_blocks returns, which might be 0.
> If so, we don't go down this case:
>
> if (err < 0)
> *errp = err;
>
> and we do go down this case,
>
> if (err <= 0)
> return NULL;
>
> in which case we return with *errp unset.
>
> It needs something like this, though maybe this could be made prettier/clearer.
>
> + *errp = 0;
> if (err < 0)
> *errp = err;
> if (err <= 0)
> return NULL;
> - *errp = 0;
Agreed. just initializing err variable into ext4_getblk() won't ensure *errp
will be filled with 'err' content. Thanks. I'll wait for some extra inputs and
see if is there anything else people have in mind, then release a v2 patch
--
--Carlos
--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists