[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <32896646-67b0-2007-ee2d-85e73e43da3c@kernel.org>
Date: Thu, 4 Mar 2021 08:03:47 +0100
From: Jiri Slaby <jirislaby@...nel.org>
To: Li Wang <li.wang@...driver.com>, gregkh@...uxfoundation.org,
andriy.shevchenko@...ux.intel.com, dmitry.torokhov@...il.com,
linux-kernel@...r.kernel.org
Subject: Re: [V2][PATCH] vt: keyboard, fix uninitialized variables warning
On 04. 03. 21, 4:10, Li Wang wrote:
> drivers/tty/vt/keyboard.c: In function 'vt_do_kdgkb_ioctl':
> drivers/tty/vt/keyboard.c: warning: 'ret' may be used uninitialized in this function [-Wmaybe-uninitialized]
> return ret;
> ^~~
> drivers/tty/vt/keyboard.c: warning: 'kbs' may be used uninitialized in this function [-Wmaybe-uninitialized]
> kfree(kbs);
> ^~~~~~~~~~
>
> Signed-off-by: Li Wang <li.wang@...driver.com>
> ---
> drivers/tty/vt/keyboard.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/drivers/tty/vt/keyboard.c b/drivers/tty/vt/keyboard.c
> index 7763862..62f1ecb 100644
> --- a/drivers/tty/vt/keyboard.c
> +++ b/drivers/tty/vt/keyboard.c
> @@ -2090,6 +2090,8 @@ int vt_do_kdgkb_ioctl(int cmd, struct kbsentry __user *user_kdgkb, int perm)
>
> ret = 0;
> break;
> + default:
> + return -EINVAL;
I am not biased whether to add it or not, but I would return
-ENOIOCTLCMD if we do.
> }
>
> kfree(kbs);
>
--
js
suse labs
Powered by blists - more mailing lists