Skip to contentSkip to conversation

ARM: OMAP: Fix warnings in musb_procfs.c

PATCH In review Dirk Behme 2 participants 3 messages Jan 20, 2007 – Jan 27, 2007

Subsystems (2)
lore
Share & tools
lore

Dirk Behme

author
#0 lore raw

PATCH 1/1 ARM: OMAP: Fix warnings in musb_procfs.c

ARM: OMAP: Fix warnings in musb_procfs.c:

drivers/usb/musb/musb_procfs.c: In function 'musb_proc_write':
drivers/usb/musb/musb_procfs.c:651: warning: ignoring return value of 'copy_from_user', declared with attribute warn_unused_result drivers/usb/musb/musb_procfs.c:725: warning: ignoring return value of 'copy_from_user', declared with attribute warn_unused_result

Signed-off-by Dirk Behme <dirk.behme_at_gmail.com>
drivers/usb/musb/musb_procfs.c +6 -2
Index: linux-osk/drivers/usb/musb/musb_procfs.c
===================================================================
@@ -648,7 +648,8 @@ static int musb_proc_write(struct file *
 
 	/* MOD_INC_USE_COUNT; */
 
-	copy_from_user(&cmd, buffer, 1);
+	if(unlikely(copy_from_user(&cmd, buffer, 1)))
+		return -EFAULT;
 	switch (cmd) {
 	case 'C':
 		if (pBase) {
@@ -722,7 +723,10 @@ static int musb_proc_write(struct file *
 				int i = 0, level = 0, sign = 1;
 				int len = min(count - 1, (unsigned long)8);
 
-				copy_from_user(&digits, &buffer[1], len);
+				if(unlikely(copy_from_user(&digits,
+							   &buffer[1],
+							   len)))
+					return -EFAULT;
 
 				/* optional sign */
 				if (*p == '-') {
author
#1 lore raw
Quoted 1 line · Dirk Behme

ARM: OMAP: Fix warnings in musb_procfs.c:

What's about this one? Do I overlooked any comments?

It's the last one in my pending patches list ;)

Orginal post:

http://linux.omap.com/pipermail/linux-omap-open-source/2007-January/008903.html

Quoted 40 lines

drivers/usb/musb/musb_procfs.c: In function 'musb_proc_write':
drivers/usb/musb/musb_procfs.c:651: warning: ignoring return value of 'copy_from_user', declared with attribute warn_unused_result drivers/usb/musb/musb_procfs.c:725: warning: ignoring return value of 'copy_from_user', declared with attribute warn_unused_result

Signed-off-by Dirk Behme <dirk.behme_at_gmail.com>

------------------------------------------------------------------------

Index: linux-osk/drivers/usb/musb/musb_procfs.c
===================================================================

drivers/usb/musb/musb_procfs.c +6 -2
@@ -648,7 +648,8 @@ static int musb_proc_write(struct file *
 
 	/* MOD_INC_USE_COUNT; */
 
-	copy_from_user(&cmd, buffer, 1);
+	if(unlikely(copy_from_user(&cmd, buffer, 1)))
+		return -EFAULT;
 	switch (cmd) {
 	case 'C':
 		if (pBase) {
@@ -722,7 +723,10 @@ static int musb_proc_write(struct file *
 				int i = 0, level = 0, sign = 1;
 				int len = min(count - 1, (unsigned long)8);
 
-				copy_from_user(&digits, &buffer[1], len);
+				if(unlikely(copy_from_user(&digits,
+							   &buffer[1],
+							   len)))
+					return -EFAULT;
 
 				/* optional sign */
 				if (*p == '-') {
#2 lore raw
Quoted 4 lines · Dirk Behme
Quoted 1 line · Dirk Behme

ARM: OMAP: Fix warnings in musb_procfs.c:

What's about this one? Do I overlooked any comments?

Oh yeah, I was hoping Dave would have a chance to look at the pending usb patches... This one is a no brainer though :)

Quoted 5 lines

It's the last one in my pending patches list ;)

Orginal post:

http://linux.omap.com/pipermail/linux-omap-open-source/2007-January/008903.html

See also Felipe's fix for rmmoding musb_hdrc to remove extra register write after chip is already powered down:

http://linux.omap.com/pipermail/linux-omap-open-source/2007-January/008853.html

Then there's Kuyngmin's DMA patch for 24xx:

http://linux.omap.com/pipermail/linux-omap-open-source/2006-November/008342.html

Regards,

Tony