Skip to content

Commit 6904d3d

Browse files
Christoph HellwigAl Viro
authored andcommitted
powerpc/spufs: stop using access_ok
Just use the proper non __-prefixed get/put_user variants where that is not done yet. Signed-off-by: Christoph Hellwig <[email protected]> Signed-off-by: Jeremy Kerr <[email protected]> Signed-off-by: Christoph Hellwig <[email protected]> Signed-off-by: Al Viro <[email protected]>
1 parent 88413a6 commit 6904d3d

File tree

1 file changed

+8
-34
lines changed
  • arch/powerpc/platforms/cell/spufs

1 file changed

+8
-34
lines changed

arch/powerpc/platforms/cell/spufs/file.c

Lines changed: 8 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -590,17 +590,12 @@ static ssize_t spufs_mbox_read(struct file *file, char __user *buf,
590590
size_t len, loff_t *pos)
591591
{
592592
struct spu_context *ctx = file->private_data;
593-
u32 mbox_data, __user *udata;
593+
u32 mbox_data, __user *udata = (void __user *)buf;
594594
ssize_t count;
595595

596596
if (len < 4)
597597
return -EINVAL;
598598

599-
if (!access_ok(buf, len))
600-
return -EFAULT;
601-
602-
udata = (void __user *)buf;
603-
604599
count = spu_acquire(ctx);
605600
if (count)
606601
return count;
@@ -616,7 +611,7 @@ static ssize_t spufs_mbox_read(struct file *file, char __user *buf,
616611
* but still need to return the data we have
617612
* read successfully so far.
618613
*/
619-
ret = __put_user(mbox_data, udata);
614+
ret = put_user(mbox_data, udata);
620615
if (ret) {
621616
if (!count)
622617
count = -EFAULT;
@@ -698,17 +693,12 @@ static ssize_t spufs_ibox_read(struct file *file, char __user *buf,
698693
size_t len, loff_t *pos)
699694
{
700695
struct spu_context *ctx = file->private_data;
701-
u32 ibox_data, __user *udata;
696+
u32 ibox_data, __user *udata = (void __user *)buf;
702697
ssize_t count;
703698

704699
if (len < 4)
705700
return -EINVAL;
706701

707-
if (!access_ok(buf, len))
708-
return -EFAULT;
709-
710-
udata = (void __user *)buf;
711-
712702
count = spu_acquire(ctx);
713703
if (count)
714704
goto out;
@@ -727,7 +717,7 @@ static ssize_t spufs_ibox_read(struct file *file, char __user *buf,
727717
}
728718

729719
/* if we can't write at all, return -EFAULT */
730-
count = __put_user(ibox_data, udata);
720+
count = put_user(ibox_data, udata);
731721
if (count)
732722
goto out_unlock;
733723

@@ -741,7 +731,7 @@ static ssize_t spufs_ibox_read(struct file *file, char __user *buf,
741731
* but still need to return the data we have
742732
* read successfully so far.
743733
*/
744-
ret = __put_user(ibox_data, udata);
734+
ret = put_user(ibox_data, udata);
745735
if (ret)
746736
break;
747737
}
@@ -836,17 +826,13 @@ static ssize_t spufs_wbox_write(struct file *file, const char __user *buf,
836826
size_t len, loff_t *pos)
837827
{
838828
struct spu_context *ctx = file->private_data;
839-
u32 wbox_data, __user *udata;
829+
u32 wbox_data, __user *udata = (void __user *)buf;
840830
ssize_t count;
841831

842832
if (len < 4)
843833
return -EINVAL;
844834

845-
udata = (void __user *)buf;
846-
if (!access_ok(buf, len))
847-
return -EFAULT;
848-
849-
if (__get_user(wbox_data, udata))
835+
if (get_user(wbox_data, udata))
850836
return -EFAULT;
851837

852838
count = spu_acquire(ctx);
@@ -873,7 +859,7 @@ static ssize_t spufs_wbox_write(struct file *file, const char __user *buf,
873859
/* write as much as possible */
874860
for (count = 4, udata++; (count + 4) <= len; count += 4, udata++) {
875861
int ret;
876-
ret = __get_user(wbox_data, udata);
862+
ret = get_user(wbox_data, udata);
877863
if (ret)
878864
break;
879865

@@ -1982,9 +1968,6 @@ static ssize_t spufs_mbox_info_read(struct file *file, char __user *buf,
19821968
u32 stat, data;
19831969
int ret;
19841970

1985-
if (!access_ok(buf, len))
1986-
return -EFAULT;
1987-
19881971
ret = spu_acquire_saved(ctx);
19891972
if (ret)
19901973
return ret;
@@ -2028,9 +2011,6 @@ static ssize_t spufs_ibox_info_read(struct file *file, char __user *buf,
20282011
u32 stat, data;
20292012
int ret;
20302013

2031-
if (!access_ok(buf, len))
2032-
return -EFAULT;
2033-
20342014
ret = spu_acquire_saved(ctx);
20352015
if (ret)
20362016
return ret;
@@ -2082,9 +2062,6 @@ static ssize_t spufs_wbox_info_read(struct file *file, char __user *buf,
20822062
u32 data[ARRAY_SIZE(ctx->csa.spu_mailbox_data)];
20832063
int ret, count;
20842064

2085-
if (!access_ok(buf, len))
2086-
return -EFAULT;
2087-
20882065
ret = spu_acquire_saved(ctx);
20892066
if (ret)
20902067
return ret;
@@ -2143,9 +2120,6 @@ static ssize_t spufs_dma_info_read(struct file *file, char __user *buf,
21432120
struct spu_dma_info info;
21442121
int ret;
21452122

2146-
if (!access_ok(buf, len))
2147-
return -EFAULT;
2148-
21492123
ret = spu_acquire_saved(ctx);
21502124
if (ret)
21512125
return ret;

0 commit comments

Comments
 (0)