From: Xunlei Pang <xpang@redhat.com>
To: Dan Carpenter <dan.carpenter@oracle.com>,
Andrew Morton <akpm@linux-foundation.org>,
Vivek Goyal <vgoyal@redhat.com>
Cc: Dave Young <dyoung@redhat.com>, Xunlei Pang <xlpang@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 16:52:43 +0800 [thread overview]
Message-ID: <56E2875B.8010909@redhat.com> (raw)
In-Reply-To: <20160311080747.GA31887@mwanda>
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.
Regards,
Xunlei
next prev parent reply other threads:[~2016-03-11 8:54 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 [this message]
2016-03-11 9:19 ` Dan Carpenter
2016-03-11 9:47 ` walter harms
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=56E2875B.8010909@redhat.com \
--to=xpang@redhat.com \
--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