[Skiboot] [PATCH] sensors: dts: Fix uninitialised data in dts result when reading asynchronously

Nicholas Piggin npiggin at gmail.com
Tue Mar 27 17:12:17 AEDT 2018


On Tue, 27 Mar 2018 17:01:26 +1100
Stewart Smith <stewart at linux.vnet.ibm.com> wrote:

> Nicholas Piggin <npiggin at gmail.com> writes:
> > dts_async_read_temp() must zero its on-stack dts structure, similarly
> > to dts_sensor_read().
> >
> > Cc: Shilpasri G Bhat <shilpa.bhat at linux.vnet.ibm.com>
> > Cc: Cédric Le Goater <clg at kaod.org>
> > Signed-off-by: Nicholas Piggin <npiggin at gmail.com>
> > ---
> >
> > The used uninitialized warning showed up when I tried to compile
> > skiboot with -O2. Too bad -Os and other static checkers didn't
> > catch it.  
> 
> Any idea what gcc gave it? I think the warning is wrong, as we have the
> struct being initialized to zero:
> 
> static void dts_async_read_temp(struct timer *t __unused, void *data,
>                                 u64 now __unused)
> {
>         struct dts dts = {0};
> 
> which, according to K&R should mean all members are zeroed.
> 
> Or am I suitably jetlagged and missing something?
> 

Yeah it wasn't in the tree until just now... I missed that it was
in Cyril's fixes, so this patch can be dropped.

Thanks,
Nick


More information about the Skiboot mailing list