
From: Al Viro <viro@zeniv.linux.org.uk> stable inclusion from stable-5.10 category: feature commit:ff847781049c37dff9ad4af2bf2d7aad02622f96 issue: #I4919J -------------------------------- don't bother trying to do bulk access_ok() Signed-off-by: Al Viro <viro@zeniv.linux.org.uk> (cherry picked from commit ff847781049c37dff9ad4af2bf2d7aad02622f96) Signed-off-by: roger <kongzhengrong@huawei.com> --- fs/pstore/ram_core.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/fs/pstore/ram_core.c b/fs/pstore/ram_core.c index a908ed97a24c..4a947bb60210 100644 --- a/fs/pstore/ram_core.c +++ b/fs/pstore/ram_core.c @@ -282,7 +282,7 @@ static int notrace persistent_ram_update_user(struct persistent_ram_zone *prz, const void __user *s, unsigned int start, unsigned int count) { struct persistent_ram_buffer *buffer = prz->buffer; - int ret = unlikely(__copy_from_user(buffer->data + start, s, count)) ? + int ret = unlikely(copy_from_user(buffer->data + start, s, count)) ? -EFAULT : 0; persistent_ram_update_ecc(prz, start, count); return ret; @@ -347,8 +347,6 @@ int notrace persistent_ram_write_user(struct persistent_ram_zone *prz, int rem, ret = 0, c = count; size_t start; - if (unlikely(!access_ok(VERIFY_READ, s, count))) - return -EFAULT; if (unlikely(c > prz->buffer_size)) { s += c - prz->buffer_size; c = prz->buffer_size; -- 2.17.1