sg_io: don't perform unneeded copy in compat code
PATCH 4/7 sg_io: don't perform unneeded copy in compat code
From: Alexey Zaytsev <[email protected]>
The members from 'status' in struct sg_io_hdr to the last are used to transfer information from kernel to user space. The values that user space sets are just ignored.
---
fs/compat_ioctl.c | 6 ------ 1 file changed, 6 deletions(-)
fs/compat_ioctl.c renamed from fs/compat_ioctl.c~sg_io-dont-perform-unneeded-copy-in-compat-code +0 -6
@@ -787,12 +787,6 @@ static int sg_ioctl_trans(unsigned int fif (put_user (compat_ptr (data), &sgio->usr_ptr))return -EFAULT ; -if (copy_in_user (&sgio->status, &sgio32->status, - (4 *sizeof (unsigned char )) + - (2 *sizeof (unsigned short )) + - (3 *sizeof (int )))) -return -EFAULT ; - err =sys_ioctl (fd, cmd, (unsigned long ) sgio);if (err >=0 ) {
_
Quoted 23 lines · On Wed, 10 Jun 2009 12:56:56 -0700 [email protected] wrote:
From: Alexey Zaytsev <[email protected]>
The members from 'status' in struct
sg_io_hdrto the last are used to transfer information from kernel to user space. The values that user space sets are just ignored.Signed-off-by Alexey Zaytsev <[email protected]>Cc Douglas Gilbert <[email protected]>Cc James Bottomley <[email protected]>Cc Jens Axboe <[email protected]>Cc FUJITA Tomonori <[email protected]>Signed-off-by Andrew Morton <[email protected]>---
fs/compat_ioctl.c | 6 ------ 1 file changed, 6 deletions(-)diff -puN
fs/compat_ioctl.c~sg_io-dont-perform-unneeded-copy-in-compat-codefs/compat_ioctl.cfs/compat_ioctl.c renamed from fs/compat_ioctl.c~sg_io-dont-perform-unneeded-copy-in-compat-code +0
-0@@ -787,12 +787,6 @@ static int sg_ioctl_trans(unsigned int fif (put_user (compat_ptr (data), &sgio->usr_ptr))return -EFAULT ;
fs/compat_ioctl.c static int sg_ioctl_trans(unsigned int f · line 792
Quoted 10 lines
fs/compat_ioctl.c renamed from fs/compat_ioctl.c~sg_io-dont-perform-unneeded-copy-in-compat-code +0
-6-if (copy_in_user (&sgio->status, &sgio32->status, - (4 *sizeof (unsigned char )) + - (2 *sizeof (unsigned short )) + - (3 *sizeof (int )))) -return -EFAULT ; - err =sys_ioctl (fd, cmd, (unsigned long ) sgio);if (err >=0 ) {
Jens Axboe
Acked-byQuoted 35 lines · FUJITA Tomonori
Quoted 32 lines · On Wed, 10 Jun 2009 12:56:56 -0700 [email protected] wrote:
From: Alexey Zaytsev <[email protected]>
The members from 'status' in struct
sg_io_hdrto the last are used to transfer information from kernel to user space. The values that user space sets are just ignored.Signed-off-by Alexey Zaytsev <[email protected]>Cc Douglas Gilbert <[email protected]>Cc James Bottomley <[email protected]>Cc Jens Axboe <[email protected]>Cc FUJITA Tomonori <[email protected]>Signed-off-by Andrew Morton <[email protected]>---
fs/compat_ioctl.c | 6 ------ 1 file changed, 6 deletions(-)diff -puN
fs/compat_ioctl.c~sg_io-dont-perform-unneeded-copy-in-compat-codefs/compat_ioctl.cfs/compat_ioctl.c renamed from fs/compat_ioctl.c~sg_io-dont-perform-unneeded-copy-in-compat-code +0
-6@@ -787,12 +787,6 @@ static int sg_ioctl_trans(unsigned int fif (put_user (compat_ptr (data), &sgio->usr_ptr))return -EFAULT ; -if (copy_in_user (&sgio->status, &sgio32->status, - (4 *sizeof (unsigned char )) + - (2 *sizeof (unsigned short )) + - (3 *sizeof (int )))) -return -EFAULT ; - err =sys_ioctl (fd, cmd, (unsigned long ) sgio);
Quoted 3 lines
fs/compat_ioctl.c static int sg_ioctl_trans(unsigned int f · line 792
Quoted 1 line
fs/compat_ioctl.c renamed from fs/compat_ioctl.c~sg_io-dont-perform-unneeded-copy-in-compat-code +0
-0if (err >=0 ) {Acked-by FUJITA Tomonori <[email protected]>
Ditto from me.
Signature · 1 line
Jens Axboe