lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-ID: <a87dd5ae-2143-4de6-a3e2-9c1f16a001b1@web.de>
Date: Thu, 30 Oct 2025 20:20:07 +0100
From: Markus Elfring <Markus.Elfring@....de>
To: linux-arm-kernel@...ts.infradead.org, Abbott Liu
 <liuwenliang@...wei.com>, Andrew Morton <akpm@...ux-foundation.org>,
 Andrey Ryabinin <aryabinin@...tuozzo.com>, Ard Biesheuvel <ardb@...nel.org>,
 Dave Hansen <dave.hansen@...ux.intel.com>,
 Florian Fainelli <f.fainelli@...il.com>,
 Kevin Brodsky <kevin.brodsky@....com>,
 Linus Walleij <linus.walleij@...aro.org>,
 Qi Zheng <zhengqi.arch@...edance.com>, Russell King <linux@...linux.org.uk>
Cc: LKML <linux-kernel@...r.kernel.org>, kernel-janitors@...r.kernel.org,
 kasan-dev@...glegroups.com, Ahmad Fatoum <a.fatoum@...gutronix.de>,
 Alexander Potapenko <glider@...gle.com>, Dmitry Vyukov <dvyukov@...gle.com>,
 Miaoqian Lin <linmq006@...il.com>, Mike Rapoport <rppt@...ux.ibm.com>
Subject: [PATCH] ARM: mm: Use pointer from memcpy() call for assignment in
 pgd_alloc()

From: Markus Elfring <elfring@...rs.sourceforge.net>
Date: Thu, 30 Oct 2025 20:08:04 +0100

A pointer was assigned to a variable. The same pointer was used for
the destination parameter of a memcpy() call.
This function is documented in the way that the same value is returned.
Thus convert two separate statements into a direct variable assignment for
the return value from a memory copy action.

The source code was transformed by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@...rs.sourceforge.net>
---
 arch/arm/mm/pgd.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/arch/arm/mm/pgd.c b/arch/arm/mm/pgd.c
index 4eb81b7ed03a..5e90faaa4934 100644
--- a/arch/arm/mm/pgd.c
+++ b/arch/arm/mm/pgd.c
@@ -72,10 +72,8 @@ pgd_t *pgd_alloc(struct mm_struct *mm)
 	init_p4d = p4d_offset(init_pgd, TASK_SIZE);
 	init_pud = pud_offset(init_p4d, TASK_SIZE);
 	init_pmd = pmd_offset(init_pud, TASK_SIZE);
-	new_pmd = pmd_offset(new_pud, TASK_SIZE);
-	memcpy(new_pmd, init_pmd,
-	       (pmd_index(MODULES_VADDR) - pmd_index(TASK_SIZE))
-	       * sizeof(pmd_t));
+	new_pmd = memcpy(pmd_offset(new_pud, TASK_SIZE), init_pmd,
+			 (pmd_index(MODULES_VADDR) - pmd_index(TASK_SIZE)) * sizeof(pmd_t));
 	clean_dcache_area(new_pmd, PTRS_PER_PMD * sizeof(pmd_t));
 #endif /* CONFIG_KASAN */
 #endif /* CONFIG_LPAE */
-- 
2.51.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ