mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Julian Braha <julianbraha@gmail.com>
To: Nathan Chancellor <nathan@kernel.org>
Cc: nsc@kernel.org, geert@linux-m68k.org, xiang@kernel.org,
	chao@kernel.org, zbestahu@gmail.com, jefflexu@linux.alibaba.com,
	dhavale@google.com, hongbohbli@tencent.com, guochunhai@vivo.com,
	michael.bommarito@gmail.com, kees@kernel.org,
	vegard.nossum@oracle.com, sam@ravnborg.org,
	u.kleine-koenig@pengutronix.de, mmarek@suse.cz,
	linux-kernel@vger.kernel.org, linux-kbuild@vger.kernel.org,
	Geert Uytterhoeven <geert+renesas@glider.be>
Subject: Re: [PATCH] kconfig: fix extra output from savedefconfig on out-of-range defaults
Date: Fri, 4 Sep 2026 00:19:40 +0100	[thread overview]
Message-ID: <07f208ad-824a-4cf5-a360-f93546b92d6d@gmail.com> (raw)
In-Reply-To: <178847452255.440755.3609720780671235760.b4-review@b4>

On 9/3/26 23:28, Nathan Chancellor wrote:
>> The Kconfig interpreter currently allows defaults that are outside of the
>> range bounds.
>>
>> In these cases, the 'sym_validate_range' function will adjust the default
>> value to the nearest range bound. For example, see this example:
>>
>>   config A
>>     int
>>     range 1 2
>>     default 16
>>
>> Here, since the default value of 16 is greater than the bounds, the
>> effective default value gets adjusted down to the upper bound, 2.
>>
>> However, 'savedefconfig' writes non-default values, and without being
>> aware of the automatic adjustment to the range bound, it would write: A=2
> 
> Should that 'A=2' be 'A=16'?

No typo, this example is adapted from the original report where it
needlessly writes the adjusted default. In the original it was 1, here
it's 2. [1]

> 
>> This limitation is also documented in a comment: "The following fails to
>> handle the situation where a default value is further limited by the valid
>> range."
>>
>> To resolve this, let's factor out the default-range adjustment logic from
>> the existing 'sym_validate_range' function into its own
>> 'sym_get_near_range_bound' function for 'savedefconfig' to use too, so
>> that it compares against the effective value.
>>
>> Adds tests, accordingly.
>>
>> Fixes: 7cf3d73b4360 ("kconfig: add savedefconfig")
>> Assisted-by: Codex:gpt-5.6-sol
>> Reported-by: Geert Uytterhoeven <geert+renesas@glider.be>
>> Closes: https://lore.kernel.org/lkml/CAMuHMdVyUAA3L4mUkSjmnuE3cvj-+N8z-Bhxsh1wa-FQWc=fjw@mail.gmail.com/
>> Signed-off-by: Julian Braha <julianbraha@gmail.com>
> 
> Thanks for the patch!
> 
> Reviewed-by: Nathan Chancellor <nathan@kernel.org>
> 
> Given this is a long standing issue, it should probably go via
> kbuild-next for 7.4, especially in case this results in problems like
> noted downthread. I would revert commit ab74edaeb1ae ("erofs: Fix
> EROFS_FS_ZIP_LZMA_DEFAULT_MAX_STREAMS default logic") on top of that.
> 
> I will wait a little bit for the folks CC'd downthread to reply to those
> instances impacted by this change before applying this.
> 

Makes sense to me, and thanks for reviewing!

[1]
https://lore.kernel.org/lkml/c480ed6b8bf38822263e2c5b7cf32b28600f212d.1787219898.git.geert+renesas@glider.be/

- Julian Braha

  reply	other threads:[~2026-09-03 23:19 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-30 22:11 Julian Braha
2026-08-31 12:36 ` Geert Uytterhoeven
2026-09-01 10:17   ` Geert Uytterhoeven
2026-09-01 13:48     ` Julian Braha
2026-09-03 22:28 ` Nathan Chancellor
2026-09-03 23:19   ` Julian Braha [this message]
2026-09-04  3:06     ` Nathan Chancellor

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=07f208ad-824a-4cf5-a360-f93546b92d6d@gmail.com \
    --to=julianbraha@gmail.com \
    --cc=chao@kernel.org \
    --cc=dhavale@google.com \
    --cc=geert+renesas@glider.be \
    --cc=geert@linux-m68k.org \
    --cc=guochunhai@vivo.com \
    --cc=hongbohbli@tencent.com \
    --cc=jefflexu@linux.alibaba.com \
    --cc=kees@kernel.org \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=michael.bommarito@gmail.com \
    --cc=mmarek@suse.cz \
    --cc=nathan@kernel.org \
    --cc=nsc@kernel.org \
    --cc=sam@ravnborg.org \
    --cc=u.kleine-koenig@pengutronix.de \
    --cc=vegard.nossum@oracle.com \
    --cc=xiang@kernel.org \
    --cc=zbestahu@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®