From: walter harms <wharms@bfs.de>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: xlpang@redhat.com, Andrew Morton <akpm@linux-foundation.org>,
Vivek Goyal <vgoyal@redhat.com>, Dave Young <dyoung@redhat.com>,
Ingo Molnar <mingo@kernel.org>, Toshi Kani <toshi.kani@hpe.com>,
Mimi Zohar <zohar@linux.vnet.ibm.com>,
Minfei Huang <mnfhuang@gmail.com>,
linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: Re: [patch] kexec: potetially using uninitialized variable
Date: Fri, 11 Mar 2016 10:47:58 +0100 [thread overview]
Message-ID: <56E2944E.3030204@bfs.de> (raw)
In-Reply-To: <20160311091919.GD5273@mwanda>
Am 11.03.2016 10:19, schrieb Dan Carpenter:
> On Fri, Mar 11, 2016 at 04:52:43PM +0800, Xunlei Pang wrote:
>> Hi Dan,
>>
>> On 2016/03/11 at 16:07, Dan Carpenter wrote:
>>> At the end of the function we check if "ret" has a negative error code,
>>> but it seems possible that it is uninitialized.
>>>
>>> Fixes: 12db5562e035 ('kexec: load and relocate purgatory at kernel load time')
>>> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
>>>
>>> diff --git a/kernel/kexec_file.c b/kernel/kexec_file.c
>>> index 503bc2d..63d1af3 100644
>>> --- a/kernel/kexec_file.c
>>> +++ b/kernel/kexec_file.c
>>> @@ -795,7 +795,7 @@ out:
>>>
>>> static int kexec_apply_relocations(struct kimage *image)
>>> {
>>> - int i, ret;
>>> + int i, ret = 0;
>>> struct purgatory_info *pi = &image->purgatory_info;
>>> Elf_Shdr *sechdrs = pi->sechdrs;
>>>
>>
>> Look further, there is a condition at the beginning of the for loop:
>>
>>
>> if (sechdrs[i].sh_type != SHT_RELA &&
>> sechdrs[i].sh_type != SHT_REL)
>> continue;
>>
>> So, I think that's ok, but I don't konw if GCC is smart enough not to throw warnings.
>
> Ah, right...
>
> This wasn't a GCC warning. GCC misses a lot of uninitialized variable
> bugs so I'm doing this with Smatch.
>
> Anyway, I'll patch this up in Smatch to not warn about this.
>
I am not so sure about this. the point should be that the reviewer can read it easily
not if gcc complains or not.
just my 2 cents,
re,
wh
next prev parent reply other threads:[~2016-03-11 9:48 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-03-11 8:07 [patch] kexec: potetially using uninitialized variable Dan Carpenter
2016-03-11 8:52 ` Xunlei Pang
2016-03-11 9:19 ` Dan Carpenter
2016-03-11 9:47 ` walter harms [this message]
2016-03-11 15:38 ` Minfei Huang
2016-03-14 10:58 ` Dan Carpenter
2016-03-14 11:25 ` Minfei Huang
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=56E2944E.3030204@bfs.de \
--to=wharms@bfs.de \
--cc=akpm@linux-foundation.org \
--cc=dan.carpenter@oracle.com \
--cc=dyoung@redhat.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=mnfhuang@gmail.com \
--cc=toshi.kani@hpe.com \
--cc=vgoyal@redhat.com \
--cc=xlpang@redhat.com \
--cc=zohar@linux.vnet.ibm.com \
/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