Skip to contentSkip to conversation

arch/Kconfig: fix dead conditions by removing dead options

PATCH Superseded Julian Braha 3 participants 4 messages Jul 29 – Aug 21

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 arch/Kconfig: fix dead conditions by removing dead options

These two 'int' options:

ARCH_MMAP_RND_BITS_DEFAULT
ARCH_MMAP_RND_COMPAT_BITS_DEFAULT

are used directly as conditions for defaults. 'int' options should not be used as conditions, because they will always evaluate to false.

Let's remove these options, because they are not used anywhere else.

This dead code was found by kconfirm, a static analysis tool for Kconfig.

---
 arch/Kconfig | 8 --------
 1 file changed, 8 deletions(-)
arch/Kconfig +0 -8
index 89ee0d1a3775..ad14831af348 100644
@@ -1235,13 +1235,9 @@ config ARCH_MMAP_RND_BITS_MIN
 config ARCH_MMAP_RND_BITS_MAX
 	int
 
-config ARCH_MMAP_RND_BITS_DEFAULT
-	int
-
 config ARCH_MMAP_RND_BITS
 	int "Number of bits to use for ASLR of mmap base address" if EXPERT
 	range ARCH_MMAP_RND_BITS_MIN ARCH_MMAP_RND_BITS_MAX
-	default ARCH_MMAP_RND_BITS_DEFAULT if ARCH_MMAP_RND_BITS_DEFAULT
 	default ARCH_MMAP_RND_BITS_MIN
 	depends on HAVE_ARCH_MMAP_RND_BITS
 	help
@@ -1269,13 +1265,9 @@ config ARCH_MMAP_RND_COMPAT_BITS_MIN
 config ARCH_MMAP_RND_COMPAT_BITS_MAX
 	int
 
-config ARCH_MMAP_RND_COMPAT_BITS_DEFAULT
-	int
-
 config ARCH_MMAP_RND_COMPAT_BITS
 	int "Number of bits to use for ASLR of mmap base address for compatible applications" if EXPERT
 	range ARCH_MMAP_RND_COMPAT_BITS_MIN ARCH_MMAP_RND_COMPAT_BITS_MAX
-	default ARCH_MMAP_RND_COMPAT_BITS_DEFAULT if ARCH_MMAP_RND_COMPAT_BITS_DEFAULT
 	default ARCH_MMAP_RND_COMPAT_BITS_MIN
 	depends on HAVE_ARCH_MMAP_RND_COMPAT_BITS
 	help
Signature · 1 line
2.55.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 5 lines · Julian Braha

These two 'int' options:

ARCH_MMAP_RND_BITS_DEFAULT
ARCH_MMAP_RND_COMPAT_BITS_DEFAULT

Quoted 8 lines

are used directly as conditions for defaults. 'int' options should not be used as conditions, because they will always evaluate to false.

Let's remove these options, because they are not used anywhere else.

This dead code was found by kconfirm, a static analysis tool for Kconfig.

#2 lore raw
Quoted 9 lines · Arnd Bergmann
Quoted 8 lines · Julian Braha

These two 'int' options:

ARCH_MMAP_RND_BITS_DEFAULT
ARCH_MMAP_RND_COMPAT_BITS_DEFAULT

are used directly as conditions for defaults. 'int' options should not be used as conditions, because they will always evaluate to false.

Quoted 6 lines
Quoted 5 lines

Let's remove these options, because they are not used anywhere else.

This dead code was found by kconfirm, a static analysis tool for Kconfig.

Sorry to bother, but whose tree would this patch go into?

I'd like to add some type checking into Kconfig, but I need to wait until this patch is merged before making this a hard error.

- Julian Braha

Reviewed-by on v1 1/1
#3 lore raw
In reply to Julian Braha
Quoted 36 lines · Julian Braha

These two 'int' options:

ARCH_MMAP_RND_BITS_DEFAULT
ARCH_MMAP_RND_COMPAT_BITS_DEFAULT

are used directly as conditions for defaults. 'int' options should not be used as conditions, because they will always evaluate to false.

Let's remove these options, because they are not used anywhere else.

This dead code was found by kconfirm, a static analysis tool for Kconfig.

---
 arch/Kconfig | 8 --------
 1 file changed, 8 deletions(-)
arch/Kconfig +0 -4
index 89ee0d1a3775..ad14831af348 100644
@@ -1235,13 +1235,9 @@ config ARCH_MMAP_RND_BITS_MIN
 config ARCH_MMAP_RND_BITS_MAX
 	int
 
-config ARCH_MMAP_RND_BITS_DEFAULT
-	int
-
 config ARCH_MMAP_RND_BITS
 	int "Number of bits to use for ASLR of mmap base address" if EXPERT
 	range ARCH_MMAP_RND_BITS_MIN ARCH_MMAP_RND_BITS_MAX
-	default ARCH_MMAP_RND_BITS_DEFAULT if ARCH_MMAP_RND_BITS_DEFAULT
 	default ARCH_MMAP_RND_BITS_MIN
 	depends on HAVE_ARCH_MMAP_RND_BITS
 	help

arch/Kconfig config ARCH_MMAP_RND_COMPAT_BITS_MIN · line 1278

Quoted 10 lines
arch/Kconfig +0 -4
@@ -1269,13 +1265,9 @@ config ARCH_MMAP_RND_COMPAT_BITS_MIN
 config ARCH_MMAP_RND_COMPAT_BITS_MAX
 	int
 
-config ARCH_MMAP_RND_COMPAT_BITS_DEFAULT
-	int
-
 config ARCH_MMAP_RND_COMPAT_BITS
 	int "Number of bits to use for ASLR of mmap base address for compatible applications" if EXPERT
 	range ARCH_MMAP_RND_COMPAT_BITS_MIN ARCH_MMAP_RND_COMPAT_BITS_MAX
-	default ARCH_MMAP_RND_COMPAT_BITS_DEFAULT if ARCH_MMAP_RND_COMPAT_BITS_DEFAULT
Quoted 3 lines
arch/Kconfig +0 -0
 	default ARCH_MMAP_RND_COMPAT_BITS_MIN
 	depends on HAVE_ARCH_MMAP_RND_COMPAT_BITS
 	help