Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1355748
| From | Dan Carpenter <dan.carpenter@oracle.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [patch] kexec: potetially using uninitialized variable |
| Date | 2016-03-11 10:20 +0100 |
| Message-ID | <rbroJ-3VO-7@gated-at.bofh.it> (permalink) |
| References | <rbqj0-3fw-3@gated-at.bofh.it> <rbr5r-3zy-59@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
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.
regards,
dan carpenter
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[patch] kexec: potetially using uninitialized variable Dan Carpenter <dan.carpenter@oracle.com> - 2016-03-11 09:10 +0100
Re: [patch] kexec: potetially using uninitialized variable Xunlei Pang <xpang@redhat.com> - 2016-03-11 10:00 +0100
Re: [patch] kexec: potetially using uninitialized variable Dan Carpenter <dan.carpenter@oracle.com> - 2016-03-11 10:20 +0100
Re: [patch] kexec: potetially using uninitialized variable walter harms <wharms@bfs.de> - 2016-03-11 10:50 +0100
Re: [patch] kexec: potetially using uninitialized variable Minfei Huang <mnfhuang@gmail.com> - 2016-03-11 16:40 +0100
Re: [patch] kexec: potetially using uninitialized variable Dan Carpenter <dan.carpenter@oracle.com> - 2016-03-14 12:00 +0100
Re: [patch] kexec: potetially using uninitialized variable Minfei Huang <mnfhuang@gmail.com> - 2016-03-14 12:30 +0100
csiph-web