From: Dirk Behme Date: Fri, 23 Mar 2007 13:58:11 +0000 (-0400) Subject: musb_hdrc: Fix compile warnings in musb debug code X-Git-Tag: v2.6.21-omap1~71 X-Git-Url: http://pilppa.com/gitweb/?a=commitdiff_plain;h=52405e0d78ed40ce1d5813f4a747b91b78e85b44;p=linux-2.6-omap-h63xx.git musb_hdrc: Fix compile warnings in musb debug code Fix compile warnings in musb debug code; it should have been checking the value of copy_from_user(). Signed-off-by: Dirk Behme Signed-off-by: David Brownell --- diff --git a/drivers/usb/musb/musb_procfs.c b/drivers/usb/musb/musb_procfs.c index e5c69d77a99..1f7d8e8735d 100644 --- a/drivers/usb/musb/musb_procfs.c +++ b/drivers/usb/musb/musb_procfs.c @@ -648,7 +648,9 @@ static int musb_proc_write(struct file *file, const char __user *buffer, /* 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 +724,8 @@ static int musb_proc_write(struct file *file, const char __user *buffer, int i = 0, level = 0, sign = 1; int len = min(count - 1, (unsigned long)8); - copy_from_user(&digits, &buffer[1], len); + if (copy_from_user(&digits, &buffer[1], len)) + return -EFAULT; /* optional sign */ if (*p == '-') {