From: Carlos Maiolino <cmaiolino@redhat.com>
To: linux-ext4@vger.kernel.org
Subject: Re: [PATCH] ext4: fix possible non-initialized variable
Date: Mon, 10 Sep 2012 13:35:58 -0300 [thread overview]
Message-ID: <20120910163558.GA11282@andromeda.usersys.redhat.com> (raw)
In-Reply-To: <504DFE77.6070205@redhat.com>
> 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
prev parent reply other threads:[~2012-09-10 16:36 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-09-08 12:49 [PATCH] ext4: fix possible non-initialized variable Carlos Maiolino
2012-09-10 14:51 ` Eric Sandeen
2012-09-10 16:35 ` Carlos Maiolino [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20120910163558.GA11282@andromeda.usersys.redhat.com \
--to=cmaiolino@redhat.com \
--cc=linux-ext4@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).