lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHp75VcacFAvsW6zmHe8fbnetcZq4xY_LZunZjBDG3ZdfS9NRQ@mail.gmail.com>
Date:   Mon, 8 Nov 2021 10:36:33 +0200
From:   Andy Shevchenko <andy.shevchenko@...il.com>
To:     Ajay Garg <ajaygargnsit@...il.com>
Cc:     Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        Jiri Slaby <jirislaby@...nel.org>,
        Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
        Emil Renner Berthing <kernel@...il.dk>,
        "open list:SERIAL DRIVERS" <linux-serial@...r.kernel.org>,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
        Pavel Skripkin <paskripkin@...il.com>
Subject: Re: [PATCH v4] tty: vt: keyboard: add default switch-case, to handle
 smatch-warnings in method vt_do_kdgkb_ioctl

On Sun, Nov 7, 2021 at 4:10 PM Ajay Garg <ajaygargnsit@...il.com> 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@...il.com>
>         * Andy Shevchenko <andy.shevchenko@...il.com>
>
>

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ