From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5CE3E26C3BD; Thu, 12 Mar 2026 20:33:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773347603; cv=none; b=ifau3vsH3PkzVQa+byt8b9BRaJsDpR0spq5r1C+RAydfIhx7vO0YajFSvaXWAfkllePErXMMaUe+uBOB0CPcPpb0uh8zQzxzGLW5uQJMZMA6pGVEwL4cXWeT6BhsmJRsa60NWZtM94K4QRQ/5OxO0bJxbuEA+1RUnWTQH50aD5c= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773347603; c=relaxed/simple; bh=l8af/BFU6S46IiR8an0I+on/r5AlQRKQ9/a0hpUNlPE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=C+N6RP8/u4ygQGihOF3zhL772c3vMehh20B9VQ0qmhLTt9/YDcanqY7URFHxtLbI711Em5diO7zUCfj59f2plAaNDK0Xryo8N4cqtjLWJG7adPAhvvrQ4IhNaY4QjeluEjAVs+Mo0EXlTxItTkzL336ni6qNAVsmAH6a0//NS+c= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=EQh+YLTB; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="EQh+YLTB" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6D29AC4CEF7; Thu, 12 Mar 2026 20:33:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1773347603; bh=l8af/BFU6S46IiR8an0I+on/r5AlQRKQ9/a0hpUNlPE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EQh+YLTB42OfRGed5UkGVcz20lmeHnXKfLDgfTfuvSfX82/HNdtQSuVGI2tfzQfEt ktCgfrsHydj2ua9d7MseDWkOTji4Qu3qWWlL+eUkNWt8dtw4c1LACNfaeM+FD2CXdw nQsphTmO6p4Y2fkQDtOgu7D9NOlO8utpkFk3yfPc= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, =?UTF-8?q?Thomas=20Wei=C3=9Fschuh?= , Linus Torvalds , Ben Hutchings Subject: [PATCH 6.12 164/265] ARM: clean up the memset64() C wrapper Date: Thu, 12 Mar 2026 21:09:11 +0100 Message-ID: <20260312201024.200206981@linuxfoundation.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260312201018.128816016@linuxfoundation.org> References: <20260312201018.128816016@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 6.12-stable review patch. If anyone has any objections, please let me know. ------------------ From: Thomas Weißschuh commit b52343d1cb47bb27ca32a3f4952cc2fd3cd165bf upstream. The current logic to split the 64-bit argument into its 32-bit halves is byte-order specific and a bit clunky. Use a union instead which is easier to read and works in all cases. GCC still generates the same machine code. While at it, rename the arguments of the __memset64() prototype to actually reflect their semantics. Signed-off-by: Thomas Weißschuh Signed-off-by: Linus Torvalds Reported-by: Ben Hutchings # for -stable Link: https://lore.kernel.org/all/1a11526ae3d8664f705b541b8d6ea57b847b49a8.camel@decadent.org.uk/ Suggested-by: https://lore.kernel.org/all/aZonkWMwpbFhzDJq@casper.infradead.org/ # for -stable Link: https://lore.kernel.org/all/aZonkWMwpbFhzDJq@casper.infradead.org/ Signed-off-by: Greg Kroah-Hartman --- arch/arm/include/asm/string.h | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) --- a/arch/arm/include/asm/string.h +++ b/arch/arm/include/asm/string.h @@ -39,13 +39,17 @@ static inline void *memset32(uint32_t *p } #define __HAVE_ARCH_MEMSET64 -extern void *__memset64(uint64_t *, uint32_t low, __kernel_size_t, uint32_t hi); +extern void *__memset64(uint64_t *, uint32_t first, __kernel_size_t, uint32_t second); static inline void *memset64(uint64_t *p, uint64_t v, __kernel_size_t n) { - if (IS_ENABLED(CONFIG_CPU_LITTLE_ENDIAN)) - return __memset64(p, v, n * 8, v >> 32); - else - return __memset64(p, v >> 32, n * 8, v); + union { + uint64_t val; + struct { + uint32_t first, second; + }; + } word = { .val = v }; + + return __memset64(p, word.first, n * 8, word.second); } /*