From: Alexey Dobriyan <adobriyan@mail.ru>
To: Al Viro <viro@parcelfarce.linux.theplanet.co.uk>
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH] sonyipi: fix sparse warnings
Date: Thu, 24 Feb 2005 13:40:37 +0200 [thread overview]
Message-ID: <200502241340.38002.adobriyan@mail.ru> (raw)
Also convert copy_{from,to}_user() of 1 and 2 byte variables to {get,put}_user().
Signed-off-by: Alexey Dobriyan <adobriyan@mail.ru>
Index: linux-2.6.11-rc4-bk9-warnings/drivers/char/sonypi.c
===================================================================
--- linux-2.6.11-rc4-bk9-warnings.orig/drivers/char/sonypi.c 2005-02-24 12:42:05.000000000 +0200
+++ linux-2.6.11-rc4-bk9-warnings/drivers/char/sonypi.c 2005-02-24 13:01:44.000000000 +0200
@@ -940,7 +940,8 @@ static int sonypi_misc_ioctl(struct inod
unsigned int cmd, unsigned long arg)
{
int ret = 0;
- void __user *argp = (void __user *)arg;
+ u8 __user *argp8 = (u8 __user *) arg;
+ u16 __user *argp16 = (u16 __user *) arg;
u8 val8;
u16 val16;
@@ -951,11 +952,11 @@ static int sonypi_misc_ioctl(struct inod
ret = -EIO;
break;
}
- if (copy_to_user(argp, &val8, sizeof(val8)))
+ if (put_user(val8, argp8))
ret = -EFAULT;
break;
case SONYPI_IOCSBRT:
- if (copy_from_user(&val8, argp, sizeof(val8))) {
+ if (get_user(val8, argp8)) {
ret = -EFAULT;
break;
}
@@ -967,7 +968,7 @@ static int sonypi_misc_ioctl(struct inod
ret = -EIO;
break;
}
- if (copy_to_user(argp, &val16, sizeof(val16)))
+ if (put_user(val16, argp16))
ret = -EFAULT;
break;
case SONYPI_IOCGBAT1REM:
@@ -975,7 +976,7 @@ static int sonypi_misc_ioctl(struct inod
ret = -EIO;
break;
}
- if (copy_to_user(argp, &val16, sizeof(val16)))
+ if (put_user(val16, argp16))
ret = -EFAULT;
break;
case SONYPI_IOCGBAT2CAP:
@@ -983,7 +984,7 @@ static int sonypi_misc_ioctl(struct inod
ret = -EIO;
break;
}
- if (copy_to_user(argp, &val16, sizeof(val16)))
+ if (put_user(val16, argp16))
ret = -EFAULT;
break;
case SONYPI_IOCGBAT2REM:
@@ -991,7 +992,7 @@ static int sonypi_misc_ioctl(struct inod
ret = -EIO;
break;
}
- if (copy_to_user(argp, &val16, sizeof(val16)))
+ if (put_user(val16, argp16))
ret = -EFAULT;
break;
case SONYPI_IOCGBATFLAGS:
@@ -1000,16 +1001,16 @@ static int sonypi_misc_ioctl(struct inod
break;
}
val8 &= 0x07;
- if (copy_to_user(argp, &val8, sizeof(val8)))
+ if (put_user(val8, argp8))
ret = -EFAULT;
break;
case SONYPI_IOCGBLUE:
val8 = sonypi_device.bluetooth_power;
- if (copy_to_user(argp, &val8, sizeof(val8)))
+ if (put_user(val8, argp8))
ret = -EFAULT;
break;
case SONYPI_IOCSBLUE:
- if (copy_from_user(&val8, argp, sizeof(val8))) {
+ if (get_user(val8, argp8)) {
ret = -EFAULT;
break;
}
@@ -1021,11 +1022,11 @@ static int sonypi_misc_ioctl(struct inod
ret = -EIO;
break;
}
- if (copy_to_user((u8 *)arg, &val8, sizeof(val8)))
+ if (put_user(val8, argp8))
ret = -EFAULT;
break;
case SONYPI_IOCSFAN:
- if (copy_from_user(&val8, (u8 *)arg, sizeof(val8))) {
+ if (get_user(val8, argp8)) {
ret = -EFAULT;
break;
}
@@ -1038,7 +1039,7 @@ static int sonypi_misc_ioctl(struct inod
ret = -EIO;
break;
}
- if (copy_to_user((u8 *)arg, &val8, sizeof(val8)))
+ if (put_user(val8, argp8))
ret = -EFAULT;
break;
default:
reply other threads:[~2005-02-24 10:41 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200502241340.38002.adobriyan@mail.ru \
--to=adobriyan@mail.ru \
--cc=linux-kernel@vger.kernel.org \
--cc=viro@parcelfarce.linux.theplanet.co.uk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®