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 EA077282F1D; Mon, 13 Apr 2026 17:32:41 +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=1776101562; cv=none; b=FWyoUKw42XL2BbIFG236eHfL4g4RFW4L5KuwLe7jVIFqP6qPEDvVVJfpu+Wy/jOsGub63ozqpeF5E0ENxOdIXYi155VMP7DR3F2hMP9DKL8gO/8x8gaP+NqyuAkQcLxJax3ka+BwCH4aDht6K4eRMrM1joH39M1EP6f/9c2hvZk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776101562; c=relaxed/simple; bh=n4ior9BW2QS6Bj3hB453qqOzgH687Hlkeuuk+QyZl4k=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=jBz5RymVEKOkYPwLnBXAmF58575RG1vCoLT/xJOxMEB03emhk66oXfGY2A1LCWn2OD5mtQyBkfrUq04uLTB0T6m/0gCN23B0kJ/MKt1Z8CgZ9G/jd2uWWk+yF4mDVU55jpkpKFFHbmYe4KXxXt4ACYLczaSfWrsZ96n4DS+HO7w= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=1apQ495a; 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="1apQ495a" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 413F8C2BCAF; Mon, 13 Apr 2026 17:32:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1776101561; bh=n4ior9BW2QS6Bj3hB453qqOzgH687Hlkeuuk+QyZl4k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1apQ495a5/f3uQWP/NMBPF1ImeyTWzBtbTm73GON7Tru+JSK5cneMRl/s11RsASaO pZu1n3t+1Mon1FuQEi3a5mwxC2JTv2WE1mpS/Lurg0Ftg3jasrTjdwtaUh48EtAD4k rcUSd6LYSruGJvqn0yQlbKXz0RhWPsI/0ZwO8VLw= 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 5.10 001/491] ARM: clean up the memset64() C wrapper Date: Mon, 13 Apr 2026 17:54:06 +0200 Message-ID: <20260413155819.104054583@linuxfoundation.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260413155819.042779211@linuxfoundation.org> References: <20260413155819.042779211@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 5.10-stable review patch. If anyone has any objections, please let me know. ------------------ From: Thomas Weißschuh [ Upstream commit b52343d1cb47bb27ca32a3f4952cc2fd3cd165bf ] 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/ --- arch/arm/include/asm/string.h | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/arch/arm/include/asm/string.h b/arch/arm/include/asm/string.h index b5ad23acb303a..369781ec55112 100644 --- a/arch/arm/include/asm/string.h +++ b/arch/arm/include/asm/string.h @@ -33,13 +33,17 @@ static inline void *memset32(uint32_t *p, uint32_t v, __kernel_size_t n) } #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); } #endif -- 2.51.0