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 <hch@lst.de> Signed-off-by: Jeremy Kerr <jk@ozlabs.org> Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
This commit is contained in:
parent
88413a6bfb
commit
6904d3d0cb
|
@ -590,17 +590,12 @@ static ssize_t spufs_mbox_read(struct file *file, char __user *buf,
|
||||||
size_t len, loff_t *pos)
|
size_t len, loff_t *pos)
|
||||||
{
|
{
|
||||||
struct spu_context *ctx = file->private_data;
|
struct spu_context *ctx = file->private_data;
|
||||||
u32 mbox_data, __user *udata;
|
u32 mbox_data, __user *udata = (void __user *)buf;
|
||||||
ssize_t count;
|
ssize_t count;
|
||||||
|
|
||||||
if (len < 4)
|
if (len < 4)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
if (!access_ok(buf, len))
|
|
||||||
return -EFAULT;
|
|
||||||
|
|
||||||
udata = (void __user *)buf;
|
|
||||||
|
|
||||||
count = spu_acquire(ctx);
|
count = spu_acquire(ctx);
|
||||||
if (count)
|
if (count)
|
||||||
return count;
|
return count;
|
||||||
|
@ -616,7 +611,7 @@ static ssize_t spufs_mbox_read(struct file *file, char __user *buf,
|
||||||
* but still need to return the data we have
|
* but still need to return the data we have
|
||||||
* read successfully so far.
|
* read successfully so far.
|
||||||
*/
|
*/
|
||||||
ret = __put_user(mbox_data, udata);
|
ret = put_user(mbox_data, udata);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
if (!count)
|
if (!count)
|
||||||
count = -EFAULT;
|
count = -EFAULT;
|
||||||
|
@ -698,17 +693,12 @@ static ssize_t spufs_ibox_read(struct file *file, char __user *buf,
|
||||||
size_t len, loff_t *pos)
|
size_t len, loff_t *pos)
|
||||||
{
|
{
|
||||||
struct spu_context *ctx = file->private_data;
|
struct spu_context *ctx = file->private_data;
|
||||||
u32 ibox_data, __user *udata;
|
u32 ibox_data, __user *udata = (void __user *)buf;
|
||||||
ssize_t count;
|
ssize_t count;
|
||||||
|
|
||||||
if (len < 4)
|
if (len < 4)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
if (!access_ok(buf, len))
|
|
||||||
return -EFAULT;
|
|
||||||
|
|
||||||
udata = (void __user *)buf;
|
|
||||||
|
|
||||||
count = spu_acquire(ctx);
|
count = spu_acquire(ctx);
|
||||||
if (count)
|
if (count)
|
||||||
goto out;
|
goto out;
|
||||||
|
@ -727,7 +717,7 @@ static ssize_t spufs_ibox_read(struct file *file, char __user *buf,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* if we can't write at all, return -EFAULT */
|
/* if we can't write at all, return -EFAULT */
|
||||||
count = __put_user(ibox_data, udata);
|
count = put_user(ibox_data, udata);
|
||||||
if (count)
|
if (count)
|
||||||
goto out_unlock;
|
goto out_unlock;
|
||||||
|
|
||||||
|
@ -741,7 +731,7 @@ static ssize_t spufs_ibox_read(struct file *file, char __user *buf,
|
||||||
* but still need to return the data we have
|
* but still need to return the data we have
|
||||||
* read successfully so far.
|
* read successfully so far.
|
||||||
*/
|
*/
|
||||||
ret = __put_user(ibox_data, udata);
|
ret = put_user(ibox_data, udata);
|
||||||
if (ret)
|
if (ret)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -836,17 +826,13 @@ static ssize_t spufs_wbox_write(struct file *file, const char __user *buf,
|
||||||
size_t len, loff_t *pos)
|
size_t len, loff_t *pos)
|
||||||
{
|
{
|
||||||
struct spu_context *ctx = file->private_data;
|
struct spu_context *ctx = file->private_data;
|
||||||
u32 wbox_data, __user *udata;
|
u32 wbox_data, __user *udata = (void __user *)buf;
|
||||||
ssize_t count;
|
ssize_t count;
|
||||||
|
|
||||||
if (len < 4)
|
if (len < 4)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
udata = (void __user *)buf;
|
if (get_user(wbox_data, udata))
|
||||||
if (!access_ok(buf, len))
|
|
||||||
return -EFAULT;
|
|
||||||
|
|
||||||
if (__get_user(wbox_data, udata))
|
|
||||||
return -EFAULT;
|
return -EFAULT;
|
||||||
|
|
||||||
count = spu_acquire(ctx);
|
count = spu_acquire(ctx);
|
||||||
|
@ -873,7 +859,7 @@ static ssize_t spufs_wbox_write(struct file *file, const char __user *buf,
|
||||||
/* write as much as possible */
|
/* write as much as possible */
|
||||||
for (count = 4, udata++; (count + 4) <= len; count += 4, udata++) {
|
for (count = 4, udata++; (count + 4) <= len; count += 4, udata++) {
|
||||||
int ret;
|
int ret;
|
||||||
ret = __get_user(wbox_data, udata);
|
ret = get_user(wbox_data, udata);
|
||||||
if (ret)
|
if (ret)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -1982,9 +1968,6 @@ static ssize_t spufs_mbox_info_read(struct file *file, char __user *buf,
|
||||||
u32 stat, data;
|
u32 stat, data;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
if (!access_ok(buf, len))
|
|
||||||
return -EFAULT;
|
|
||||||
|
|
||||||
ret = spu_acquire_saved(ctx);
|
ret = spu_acquire_saved(ctx);
|
||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -2028,9 +2011,6 @@ static ssize_t spufs_ibox_info_read(struct file *file, char __user *buf,
|
||||||
u32 stat, data;
|
u32 stat, data;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
if (!access_ok(buf, len))
|
|
||||||
return -EFAULT;
|
|
||||||
|
|
||||||
ret = spu_acquire_saved(ctx);
|
ret = spu_acquire_saved(ctx);
|
||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -2082,9 +2062,6 @@ static ssize_t spufs_wbox_info_read(struct file *file, char __user *buf,
|
||||||
u32 data[ARRAY_SIZE(ctx->csa.spu_mailbox_data)];
|
u32 data[ARRAY_SIZE(ctx->csa.spu_mailbox_data)];
|
||||||
int ret, count;
|
int ret, count;
|
||||||
|
|
||||||
if (!access_ok(buf, len))
|
|
||||||
return -EFAULT;
|
|
||||||
|
|
||||||
ret = spu_acquire_saved(ctx);
|
ret = spu_acquire_saved(ctx);
|
||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -2143,9 +2120,6 @@ static ssize_t spufs_dma_info_read(struct file *file, char __user *buf,
|
||||||
struct spu_dma_info info;
|
struct spu_dma_info info;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
if (!access_ok(buf, len))
|
|
||||||
return -EFAULT;
|
|
||||||
|
|
||||||
ret = spu_acquire_saved(ctx);
|
ret = spu_acquire_saved(ctx);
|
||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
Loading…
Reference in New Issue