Re: [PATCH] ASoC: soc-core: fix an uninitialized use

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Nick,

'ret' is only defined in if branches and for loops (e.g.
for_each_component_dais). If none of these branches or loops get executed,
then eventually we end up having

int ret;

err_probe:
        if (ret < 0)
                soc_cleanup_component(component);

With -ftrivial-auto-var-init=pattern, this code becomes

int ret;

err_probe:
       ret = 0xAAAAAAAA;
        if (ret < 0)
                soc_cleanup_component(component);

So soc_cleanup_component gets called unintentionally this case, which
causes the built kernel to miss some files.



On Thu, Feb 6, 2020 at 3:28 PM Nick Desaulniers <ndesaulniers@xxxxxxxxxx>
wrote:

> > Fixed the uninitialized use of a signed integer variable ret in
> > soc_probe_component when all its definitions are not executed. This
> > caused  -ftrivial-auto-var-init=pattern to initialize the variable to
> > repeated 0xAA (i.e. a negative value) and triggered the following code
> > unintentionally.
>
> > Signed-off-by: Jian Cai <caij2003@xxxxxxxxx>
>
> Hi Jian,
> I don't quite follow; it looks like `ret` is assigned to multiple times in
> `soc_probe_component`. Are one of the return values of one of the functions
> that are called then assigned to `ret` undefined? What control flow path
> leaves
> `ret` unitialized?
>
_______________________________________________
Alsa-devel mailing list
Alsa-devel@xxxxxxxxxxxxxxxx
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel



[Index of Archives]     [ALSA User]     [Linux Audio Users]     [Pulse Audio]     [Kernel Archive]     [Asterisk PBX]     [Photo Sharing]     [Linux Sound]     [Video 4 Linux]     [Gimp]     [Yosemite News]

  Powered by Linux