All of lore.kernel.org
 help / color / mirror / Atom feed
* + mm-memory-avoid-unnecessary-kernel-user-pointer-conversion.patch added to -mm tree
@ 2021-09-15  2:01 akpm
  0 siblings, 0 replies; only message in thread
From: akpm @ 2021-09-15  2:01 UTC (permalink / raw)
  To: amit.kachhap, mm-commits, Vincenzo.Frascino


The patch titled
     Subject: mm/memory.c: avoid unnecessary kernel/user pointer conversion
has been added to the -mm tree.  Its filename is
     mm-memory-avoid-unnecessary-kernel-user-pointer-conversion.patch

This patch should soon appear at
    https://ozlabs.org/~akpm/mmots/broken-out/mm-memory-avoid-unnecessary-kernel-user-pointer-conversion.patch
and later at
    https://ozlabs.org/~akpm/mmotm/broken-out/mm-memory-avoid-unnecessary-kernel-user-pointer-conversion.patch

Before you just go and hit "reply", please:
   a) Consider who else should be cc'ed
   b) Prefer to cc a suitable mailing list as well
   c) Ideally: find the original patch on the mailing list and do a
      reply-to-all to that, adding suitable additional cc's

*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***

The -mm tree is included into linux-next and is updated
there every 3-4 working days

------------------------------------------------------
From: Amit Daniel Kachhap <amit.kachhap@arm.com>
Subject: mm/memory.c: 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.

Link: https://lkml.kernel.org/r/20210914150820.19326-1-amit.kachhap@arm.com
Signed-off-by: Amit Daniel Kachhap <amit.kachhap@arm.com>
Cc: Vincenzo Frascino <Vincenzo.Frascino@arm.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---

 mm/memory.c |    4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

--- a/mm/memory.c~mm-memory-avoid-unnecessary-kernel-user-pointer-conversion
+++ a/mm/memory.c
@@ -5411,7 +5411,6 @@ long copy_huge_page_from_user(struct pag
 				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 pag
 		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
_

Patches currently in -mm which might be from amit.kachhap@arm.com are

mm-memory-avoid-unnecessary-kernel-user-pointer-conversion.patch


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-09-15  2:01 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-15  2:01 + mm-memory-avoid-unnecessary-kernel-user-pointer-conversion.patch added to -mm tree akpm

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.