Commit 3229b869 authored by Chen Gang's avatar Chen Gang Committed by Greg Kroah-Hartman

drivers: staging: ft1000: ft1000-usb: ft1000_debug.c: check return value of...

drivers: staging: ft1000: ft1000-usb: ft1000_debug.c: check return value of get_user() in ft1000_ioctl()

get_user() may fail and cause 'msgsz' uninitialized, so need give a
check. The related warning (with allmodconfig under hexagon):

    CC [M]  drivers/staging/ft1000/ft1000-usb/ft1000_debug.o
  drivers/staging/ft1000/ft1000-usb/ft1000_debug.c: In function 'ft1000_ioctl':
  include/uapi/linux/swab.h:53:9: warning: 'msgsz' may be used uninitialized in this function [-Wuninitialized]
  drivers/staging/ft1000/ft1000-usb/ft1000_debug.c:533:17: note: 'msgsz' was declared here
Signed-off-by: default avatarChen Gang <gang.chen.5i5j@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 358bd68c
...@@ -560,6 +560,8 @@ static long ft1000_ioctl(struct file *file, unsigned int command, ...@@ -560,6 +560,8 @@ static long ft1000_ioctl(struct file *file, unsigned int command,
/* Get the length field to see how many bytes to copy */ /* Get the length field to see how many bytes to copy */
result = get_user(msgsz, (__u16 __user *)argp); result = get_user(msgsz, (__u16 __user *)argp);
if (result)
break;
msgsz = ntohs(msgsz); msgsz = ntohs(msgsz);
/* DEBUG("FT1000:ft1000_ioctl: length of message = %d\n", msgsz); */ /* DEBUG("FT1000:ft1000_ioctl: length of message = %d\n", msgsz); */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment