Re: [PATCH] kconfig: fix extra output from savedefconfig on out-of-range defaults

From: Julian Braha

Date: Tue Sep 01 2026 - 10:05:14 EST


CC: Arnd, Christophe

On 9/1/26 11:17, Geert Uytterhoeven wrote:

> FTR, this will impact all defconfigs that restrict SERIAL_8250_NR_UARTS
> to a value lower than 4:
>
> config SERIAL_8250_NR_UARTS
> int "Maximum number of 8250/16550 serial ports"
> depends on SERIAL_8250
> default "4"
>
> config SERIAL_8250_RUNTIME_UARTS
> int "Number of 8250/16550 serial ports to register at runtime"
> depends on SERIAL_8250
> range 0 SERIAL_8250_NR_UARTS
> default "4"

I suspected that there could be some cases where these out-of-range
defaults were actually accidents and causing bugs, so I added a check
with my SMT solver [1], which also detected these two (powerpc-only):


config DATA_SHIFT
int "Data shift" if DATA_SHIFT_BOOL
default 24 if STRICT_KERNEL_RWX && PPC64
range 17 28 if (STRICT_KERNEL_RWX || DEBUG_PAGEALLOC || KFENCE) &&
PPC_BOOK3S_32
range 14 23 if (STRICT_KERNEL_RWX || DEBUG_PAGEALLOC || KFENCE) &&
PPC_8xx
range 20 24 if (STRICT_KERNEL_RWX || DEBUG_PAGEALLOC || KFENCE) &&
PPC_85xx
default 22 if STRICT_KERNEL_RWX && PPC_BOOK3S_32
default 18 if (DEBUG_PAGEALLOC || KFENCE) && PPC_BOOK3S_32
default 23 if (STRICT_KERNEL_RWX || DEBUG_PAGEALLOC || KFENCE) &&
PPC_8xx && \
(PIN_TLB_DATA || PIN_TLB_TEXT)
default 19 if (STRICT_KERNEL_RWX || DEBUG_PAGEALLOC || KFENCE) &&
PPC_8xx
default 24 if STRICT_KERNEL_RWX && PPC_85xx
default PAGE_SHIFT

config MODULES_SIZE
int "Size of modules/execmem area (In Mbytes)" if MODULES_SIZE_BOOL
range 1 256 if EXECMEM
default 64 if EXECMEM && PPC_BOOK3S_32
default 32 if EXECMEM && PPC_8xx
default 0


The DATA_SHIFT case may be bug, where it should be 12, but incorrectly
adjusts to 20 when:
PPC_85xx=y

DEBUG_PAGEALLOC=y

STRICT_KERNEL_RWX=n

PAGE_SHIFT=12

The MODULES_SIZE case seems harmless since the only systems using that
option are PPC_BOOK3S_32 and PPC_8xx.

Anyway, this change to savedefconfig would also affect those 2.

[1] https://github.com/julianbraha/kconfirm/tree/smt

- Julian Braha