linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] vt: keyboard, fix uninitialized variables warning
@ 2021-03-03  4:59 Li Wang
  2021-03-03  7:14 ` Greg KH
  0 siblings, 1 reply; 11+ messages in thread
From: Li Wang @ 2021-03-03  4:59 UTC (permalink / raw)
  To: gregkh, jirislaby, andriy.shevchenko, dmitry.torokhov,
	linux-kernel, li.wang

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;
         ^~~
kernel-source/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@windriver.com>
---
 drivers/tty/vt/keyboard.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/tty/vt/keyboard.c b/drivers/tty/vt/keyboard.c
index 7763862..3e73d55 100644
--- a/drivers/tty/vt/keyboard.c
+++ b/drivers/tty/vt/keyboard.c
@@ -2049,8 +2049,8 @@ int vt_do_kdgkb_ioctl(int cmd, struct kbsentry __user *user_kdgkb, int perm)
 {
 	unsigned char kb_func;
 	unsigned long flags;
-	char *kbs;
-	int ret;
+	char *kbs = NULL;
+	int ret = -EINVAL;
 
 	if (get_user(kb_func, &user_kdgkb->kb_func))
 		return -EFAULT;
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2021-03-04 12:32 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-03  4:59 [PATCH] vt: keyboard, fix uninitialized variables warning Li Wang
2021-03-03  7:14 ` Greg KH
2021-03-03  7:33   ` Wang, Li
2021-03-03  7:39     ` Greg KH
2021-03-03  8:24       ` Andy Shevchenko
2021-03-03  9:21         ` Wang, Li
2021-03-04  3:10           ` [V2][PATCH] " Li Wang
2021-03-04  7:03             ` Jiri Slaby
2021-03-04  7:04             ` Greg KH
2021-03-04 12:28             ` Andy Shevchenko
2021-03-04 12:30               ` Andy Shevchenko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).