From 52405e0d78ed40ce1d5813f4a747b91b78e85b44 Mon Sep 17 00:00:00 2001 From: Dirk Behme Date: Fri, 23 Mar 2007 09:58:11 -0400 Subject: [PATCH] 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 --- drivers/usb/musb/musb_procfs.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) 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 == '-') { -- 2.41.1