Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

x86/crc32: update prototype for crc32_pclmul_le_16()

- Change the len parameter from unsigned int to size_t, so that the
library function which takes a size_t can safely use this code.

- Move the crc parameter to the front, as this is the usual convention.

Reviewed-by: Ard Biesheuvel <ardb@kernel.org>
Link: https://lore.kernel.org/r/20241202010844.144356-13-ebiggers@kernel.org
Signed-off-by: Eric Biggers <ebiggers@google.com>

+11 -12
+9 -10
arch/x86/crypto/crc32-pclmul_asm.S
··· 58 58 #define CONSTANT %xmm0 59 59 60 60 #ifdef __x86_64__ 61 - #define BUF %rdi 62 - #define LEN %rsi 63 - #define CRC %edx 61 + #define CRC %edi 62 + #define BUF %rsi 63 + #define LEN %rdx 64 64 #else 65 - #define BUF %eax 66 - #define LEN %edx 67 - #define CRC %ecx 65 + #define CRC %eax 66 + #define BUF %edx 67 + #define LEN %ecx 68 68 #endif 69 69 70 70 ··· 72 72 .text 73 73 /** 74 74 * Calculate crc32 75 - * BUF - buffer (16 bytes aligned) 76 - * LEN - sizeof buffer (16 bytes aligned), LEN should be grater than 63 77 75 * CRC - initial crc32 76 + * BUF - buffer (16 bytes aligned) 77 + * LEN - sizeof buffer (16 bytes aligned), LEN should be greater than 63 78 78 * return %eax crc32 79 - * uint crc32_pclmul_le_16(unsigned char const *buffer, 80 - * size_t len, uint crc32) 79 + * u32 crc32_pclmul_le_16(u32 crc, const u8 *buffer, size_t len); 81 80 */ 82 81 83 82 SYM_FUNC_START(crc32_pclmul_le_16) /* buffer and buffer size are 16 bytes aligned */
+2 -2
arch/x86/crypto/crc32-pclmul_glue.c
··· 46 46 #define SCALE_F 16L /* size of xmm register */ 47 47 #define SCALE_F_MASK (SCALE_F - 1) 48 48 49 - u32 crc32_pclmul_le_16(unsigned char const *buffer, size_t len, u32 crc32); 49 + u32 crc32_pclmul_le_16(u32 crc, const u8 *buffer, size_t len); 50 50 51 51 static u32 __attribute__((pure)) 52 52 crc32_pclmul_le(u32 crc, unsigned char const *p, size_t len) ··· 71 71 iremainder = len & SCALE_F_MASK; 72 72 73 73 kernel_fpu_begin(); 74 - crc = crc32_pclmul_le_16(p, iquotient, crc); 74 + crc = crc32_pclmul_le_16(crc, p, iquotient); 75 75 kernel_fpu_end(); 76 76 77 77 if (iremainder)