Re: [PATCH v4] tty: vt: keyboard: add default switch-case, to handle smatch-warnings in method vt_do_kdgkb_ioctl

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

 



On Sun, Nov 7, 2021 at 4:10 PM Ajay Garg <ajaygargnsit@xxxxxxxxx> wrote:
>
> smatch-kchecker gives the following warnings when run on keyboard.c :
>
> vt_do_kdgkb_ioctl() error: uninitialized symbol 'kbs'.
> vt_do_kdgkb_ioctl() error: uninitialized symbol 'ret'.
>
> This usually happens when switch has no default case and static
> analyzers and even sometimes compilers can’t prove that all possible
> values are covered.
>
>

One blank line is enough.

> Thus, the default switch-case has been added, which sets the values
> for the two variables :
>
>         * kbs as NULL, which also nicely fits in with kfree.
>
>         * ret as -ENOIOCTLCMD (on same lines if there is no cmd
>                                match in "vt_do_kdskled" method).
>
>
> Many thanks to the following for review of previous versions :
>
>         * Pavel Skripkin <paskripkin@xxxxxxxxx>
>         * Andy Shevchenko <andy.shevchenko@xxxxxxxxx>
>
>

Ditto for each such case.

...

> +       default:
> +               kbs = NULL;

> +               ret = -ENOIOCTLCMD;

Why is this? How is it supposed to work?

> +               break;
>         }

-- 
With Best Regards,
Andy Shevchenko




[Index of Archives]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux PPP]     [Linux FS]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Linmodem]     [Device Mapper]     [Linux Kernel for ARM]

  Powered by Linux