The Linux Kernel Mailing List
 help / color / mirror / Atom feed
* [PATCH] MIPS: crypto: Clean up useless assignment operations
@ 2024-06-28  8:41 WangYuli
  2024-06-28 10:12 ` Herbert Xu
  2024-06-28 15:51 ` WangYuli
  0 siblings, 2 replies; 5+ messages in thread
From: WangYuli @ 2024-06-28  8:41 UTC (permalink / raw)
  To: herbert, davem, tsbogend
  Cc: linux-crypto, linux-mips, linux-kernel, WangYuli, Guan Wentao

When entering the "len & sizeof(u32)" branch, len must be less than 8.
So after one operation, len must be less than 4.
At this time, "len -= sizeof(u32)" is not necessary for 64-bit CPUs.

A similar issue has been solved at Loongarch.

Link: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?h=v6.10-rc5&id=fea1c949f6ca5059e12de00d0483645debc5b206
Signed-off-by: Guan Wentao <guanwentao@uniontech.com>
Signed-off-by: WangYuli <wangyuli@uniontech.com>
---
 arch/mips/crypto/crc32-mips.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/arch/mips/crypto/crc32-mips.c b/arch/mips/crypto/crc32-mips.c
index ec6d58008f8e..505d2d897849 100644
--- a/arch/mips/crypto/crc32-mips.c
+++ b/arch/mips/crypto/crc32-mips.c
@@ -94,7 +94,9 @@ static u32 crc32_mips_le_hw(u32 crc_, const u8 *p, unsigned int len)
 
 		CRC32(crc, value, w);
 		p += sizeof(u32);
+#ifndef CONFIG_64BIT
 		len -= sizeof(u32);
+#endif
 	}
 
 	if (len & sizeof(u16)) {
@@ -134,7 +136,9 @@ static u32 crc32c_mips_le_hw(u32 crc_, const u8 *p, unsigned int len)
 
 		CRC32C(crc, value, w);
 		p += sizeof(u32);
+#ifndef CONFIG_64BIT
 		len -= sizeof(u32);
+#endif
 	}
 
 	if (len & sizeof(u16)) {
-- 
2.43.4


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2024-06-28 16:42 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-06-28  8:41 [PATCH] MIPS: crypto: Clean up useless assignment operations WangYuli
2024-06-28 10:12 ` Herbert Xu
2024-06-28 15:51 ` WangYuli
2024-06-28 15:59   ` Wentao Guan
2024-06-28 16:42   ` Maciej W. Rozycki

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox