[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20210914150820.19326-1-amit.kachhap@arm.com>
Date: Tue, 14 Sep 2021 20:38:20 +0530
From: Amit Daniel Kachhap <amit.kachhap@....com>
To: linux-mm@...ck.org
Cc: linux-kernel@...r.kernel.org,
Vincenzo Frascino <Vincenzo.Frascino@....com>,
Amit Daniel Kachhap <amit.kachhap@....com>,
Andrew Morton <akpm@...ux-foundation.org>
Subject: [PATCH] mm/memory: Avoid unnecessary kernel/user pointer conversion
Annotating a pointer from __user to kernel and then back again might
confuse sparse. In copy_huge_page_from_user() it can be avoided by
removing the intermediate variable since it is never used.
Cc: Andrew Morton <akpm@...ux-foundation.org>
Signed-off-by: Amit Daniel Kachhap <amit.kachhap@....com>
---
mm/memory.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/mm/memory.c b/mm/memory.c
index 25fc46e87214..90970d19b7dd 100644
--- a/mm/memory.c
+++ b/mm/memory.c
@@ -5411,7 +5411,6 @@ long copy_huge_page_from_user(struct page *dst_page,
unsigned int pages_per_huge_page,
bool allow_pagefault)
{
- void *src = (void *)usr_src;
void *page_kaddr;
unsigned long i, rc = 0;
unsigned long ret_val = pages_per_huge_page * PAGE_SIZE;
@@ -5424,8 +5423,7 @@ long copy_huge_page_from_user(struct page *dst_page,
else
page_kaddr = kmap_atomic(subpage);
rc = copy_from_user(page_kaddr,
- (const void __user *)(src + i * PAGE_SIZE),
- PAGE_SIZE);
+ usr_src + i * PAGE_SIZE, PAGE_SIZE);
if (allow_pagefault)
kunmap(subpage);
else
--
2.17.1
Powered by blists - more mailing lists