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

Stewart Smith stewart at linux.vnet.ibm.com
Tue Mar 27 17:01:26 AEDT 2018


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?

-- 
Stewart Smith
OPAL Architect, IBM.



More information about the Skiboot mailing list