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.

kernel.h: removed REPEAT_BYTE from kernel.h

This patch creates wordpart.h and includes it in asm/word-at-a-time.h
for all architectures. WORD_AT_A_TIME_CONSTANTS depends on kernel.h
because of REPEAT_BYTE. Moving this to another header and including it
where necessary allows us to not include the bloated kernel.h. Making
this implicit dependency on REPEAT_BYTE explicit allows for later
improvements in the lib/string.c inclusion list.

Suggested-by: Al Viro <viro@zeniv.linux.org.uk>
Suggested-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Tanzir Hasan <tanzirh@google.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Link: https://lore.kernel.org/r/20231226-libstringheader-v6-1-80aa08c7652c@google.com
Signed-off-by: Kees Cook <keescook@chromium.org>

authored by

Tanzir Hasan and committed by
Kees Cook
66a5c40f 735b7636

+31 -17
+2 -1
arch/arm/include/asm/word-at-a-time.h
··· 8 8 * Little-endian word-at-a-time zero byte handling. 9 9 * Heavily based on the x86 algorithm. 10 10 */ 11 - #include <linux/kernel.h> 11 + #include <linux/bitops.h> 12 + #include <linux/wordpart.h> 12 13 13 14 struct word_at_a_time { 14 15 const unsigned long one_bits, high_bits;
+2 -1
arch/arm64/include/asm/word-at-a-time.h
··· 9 9 10 10 #ifndef __AARCH64EB__ 11 11 12 - #include <linux/kernel.h> 12 + #include <linux/bitops.h> 13 + #include <linux/wordpart.h> 13 14 14 15 struct word_at_a_time { 15 16 const unsigned long one_bits, high_bits;
+2 -2
arch/powerpc/include/asm/word-at-a-time.h
··· 4 4 /* 5 5 * Word-at-a-time interfaces for PowerPC. 6 6 */ 7 - 8 - #include <linux/kernel.h> 7 + #include <linux/bitops.h> 8 + #include <linux/wordpart.h> 9 9 #include <asm/asm-compat.h> 10 10 #include <asm/extable.h> 11 11
+2 -1
arch/riscv/include/asm/word-at-a-time.h
··· 10 10 11 11 12 12 #include <asm/asm-extable.h> 13 - #include <linux/kernel.h> 13 + #include <linux/bitops.h> 14 + #include <linux/wordpart.h> 14 15 15 16 struct word_at_a_time { 16 17 const unsigned long one_bits, high_bits;
+2 -1
arch/s390/include/asm/word-at-a-time.h
··· 2 2 #ifndef _ASM_WORD_AT_A_TIME_H 3 3 #define _ASM_WORD_AT_A_TIME_H 4 4 5 - #include <linux/kernel.h> 5 + #include <linux/bitops.h> 6 + #include <linux/wordpart.h> 6 7 #include <asm/asm-extable.h> 7 8 #include <asm/bitsperlong.h> 8 9
+2
arch/sh/include/asm/word-at-a-time.h
··· 5 5 #ifdef CONFIG_CPU_BIG_ENDIAN 6 6 # include <asm-generic/word-at-a-time.h> 7 7 #else 8 + #include <linux/bitops.h> 9 + #include <linux/wordpart.h> 8 10 /* 9 11 * Little-endian version cribbed from x86. 10 12 */
+2 -1
arch/x86/include/asm/word-at-a-time.h
··· 2 2 #ifndef _ASM_WORD_AT_A_TIME_H 3 3 #define _ASM_WORD_AT_A_TIME_H 4 4 5 - #include <linux/kernel.h> 5 + #include <linux/bitops.h> 6 + #include <linux/wordpart.h> 6 7 7 8 /* 8 9 * This is largely generic for little-endian machines, but the
+1
arch/x86/kvm/mmu/mmu.c
··· 47 47 #include <linux/kern_levels.h> 48 48 #include <linux/kstrtox.h> 49 49 #include <linux/kthread.h> 50 + #include <linux/wordpart.h> 50 51 51 52 #include <asm/page.h> 52 53 #include <asm/memtype.h>
+1 -1
fs/namei.c
··· 17 17 18 18 #include <linux/init.h> 19 19 #include <linux/export.h> 20 - #include <linux/kernel.h> 21 20 #include <linux/slab.h> 21 + #include <linux/wordpart.h> 22 22 #include <linux/fs.h> 23 23 #include <linux/filelock.h> 24 24 #include <linux/namei.h>
+2 -1
include/asm-generic/word-at-a-time.h
··· 2 2 #ifndef _ASM_WORD_AT_A_TIME_H 3 3 #define _ASM_WORD_AT_A_TIME_H 4 4 5 - #include <linux/kernel.h> 5 + #include <linux/bitops.h> 6 + #include <linux/wordpart.h> 6 7 #include <asm/byteorder.h> 7 8 8 9 #ifdef __BIG_ENDIAN
-8
include/linux/kernel.h
··· 39 39 40 40 #define STACK_MAGIC 0xdeadbeef 41 41 42 - /** 43 - * REPEAT_BYTE - repeat the value @x multiple times as an unsigned long value 44 - * @x: value to repeat 45 - * 46 - * NOTE: @x is not checked for > 0xff; larger values produce odd results. 47 - */ 48 - #define REPEAT_BYTE(x) ((~0ul / 0xff) * (x)) 49 - 50 42 /* generic data direction definitions */ 51 43 #define READ 0 52 44 #define WRITE 1
+13
include/linux/wordpart.h
··· 1 + /* SPDX-License-Identifier: GPL-2.0 */ 2 + 3 + #ifndef _LINUX_WORDPART_H 4 + #define _LINUX_WORDPART_H 5 + /** 6 + * REPEAT_BYTE - repeat the value @x multiple times as an unsigned long value 7 + * @x: value to repeat 8 + * 9 + * NOTE: @x is not checked for > 0xff; larger values produce odd results. 10 + */ 11 + #define REPEAT_BYTE(x) ((~0ul / 0xff) * (x)) 12 + 13 + #endif // _LINUX_WORDPART_H