[patch] Staging: ft1000-usb: copying to wrong location

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

 



We made "dpram_data" a pointer ealier but missed one place which needs
to be changed.  It causes a compile error with
CONFIG_DEBUG_STRICT_USER_COPY_CHECKS=y

In function âcopy_from_userâ,
    inlined from âft1000_ChIoctlâ at
	drivers/staging/ft1000/ft1000-usb/ft1000_chdev.c:701:
	arch/x86/include/asm/uaccess_32.h:212: 	error: call to
	âcopy_from_user_overflowâ declared with attribute error:
	copy_from_user() buffer size is not provably correct
make[4]: *** [drivers/staging/ft1000/ft1000-usb/ft1000_chdev.o] Error 1

Also I initialized "dpram_data" to NULL.  That silences a compiler
warning from where we pass uninitialized data to the kfree(dpram_data);

Signed-off-by: Dan Carpenter <error27@xxxxxxxxx>

diff --git a/drivers/staging/ft1000/ft1000-usb/ft1000_chdev.c b/drivers/staging/ft1000/ft1000-usb/ft1000_chdev.c
index 20d5098..d546750 100644
--- a/drivers/staging/ft1000/ft1000-usb/ft1000_chdev.c
+++ b/drivers/staging/ft1000/ft1000-usb/ft1000_chdev.c
@@ -650,7 +650,7 @@ static long ft1000_ChIoctl (struct file *File, unsigned int Command,
         break;
     case IOCTL_SET_DPRAM_CMD:
         {
-            IOCTL_DPRAM_BLK *dpram_data;
+            IOCTL_DPRAM_BLK *dpram_data = NULL;
             //IOCTL_DPRAM_COMMAND dpram_command;
             USHORT qtype;
             USHORT msgsz;
@@ -698,7 +698,7 @@ static long ft1000_ChIoctl (struct file *File, unsigned int Command,
 			break;
 
                 //if ( copy_from_user(&(dpram_command.dpram_blk), (PIOCTL_DPRAM_BLK)Argument, msgsz+2) ) {
-                if ( copy_from_user(&dpram_data, argp, msgsz+2) ) {
+                if (copy_from_user(dpram_data, argp, msgsz + 2)) {
                     DEBUG("FT1000:ft1000_ChIoctl: copy fault occurred\n");
                     result = -EFAULT;
                 }
--
To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Kernel Development]     [Kernel Announce]     [Kernel Newbies]     [Linux Networking Development]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Device Mapper]

  Powered by Linux