Message ID | 20240126133010.78999-1-masahiroy@kernel.org |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel+bounces-40131-ouuuleilei=gmail.com@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:e09d:b0:103:945f:af90 with SMTP id gm29csp658054dyb; Fri, 26 Jan 2024 05:30:31 -0800 (PST) X-Google-Smtp-Source: AGHT+IHiZxfb5a6ebweN7xKVy+KXXJvjSJQDPMECRSfI5MNZNsuvou4xTvd5mP1PYQk95GT0yl2F X-Received: by 2002:a05:6a00:1b49:b0:6dd:e315:1ef2 with SMTP id o9-20020a056a001b4900b006dde3151ef2mr1065403pfv.69.1706275830949; Fri, 26 Jan 2024 05:30:30 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706275830; cv=pass; d=google.com; s=arc-20160816; b=O7ouPsvC3AKSmNREnp/yW4wsvUrgm66k0IMwrsOMdTaEVYoLSHGzojJ0ckYGx+AYyq 2VfPX899NgYekbAsSIl6zLhAMn/mGNHrDZT42D7EGGFFXmMrE+GwxC2eUXZJEbIN8H8j 8eFWP1GGtDihRAA2/zvnO+zNTqCdjvMtPVIzHhUoytO7XGZ4+Bvr3HNG9fFhH/vA9oWu IKeNbuI6PV0TfwfZwZMb4g4OEse7+yIPDlIs54Kaxv4DbZny8qiEibxxqOi6AIi6DTFr /xe/1TzvaUzNP5esKZBdPH/X+eptTqUZQWAVEp5DorFJMGXYprS2237pxx4+07bf6z7o JXuw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=d2vqg3MWJ471wE6DseZlB+LHPvIkHV8mov23JmTnPhU=; fh=4ydV0t2CSxmvRzaUdFUpDk1f3d/KUFVvbb2VdBso51E=; b=rr2cmqMXfATMKlnFFc7kZyaFUXZ8SDeaQLKFOlEYGrVPzCgFi/punpZmN81Tt80Pjb 8uF3i7Y+Gep4Dlap9wH2Y5S3s9GIisvPPpv0rY3+5A2sNrorxs/QktVRil0W1uVKELtJ 6s41T2z6GxZu+EAQyAx2z2P7ZJNA7rXnnej0ELGjPWozyIK7sNZ/Hu6gvPWyn/pkqswU q+ZKOJGk5Do17MPn//2/V2JfgF4vycEMKrKhDXOGrpCJDyMwcAlwgL6XerrgDv6dX62O Bqvuk/UT/70fbM8ci7nRCpzsmVVUOEa4b68HXP3rxVoMkO8+LWYTF/OJXrY1DE0s0Lpn oLaQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=IaZc+ud7; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-40131-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-40131-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id ka31-20020a056a00939f00b006ddced9e9dfsi1189829pfb.51.2024.01.26.05.30.30 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 Jan 2024 05:30:30 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-40131-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=IaZc+ud7; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-40131-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-40131-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id AB3C52861ED for <ouuuleilei@gmail.com>; Fri, 26 Jan 2024 13:30:30 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 179E71B958; Fri, 26 Jan 2024 13:30:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="IaZc+ud7" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 603B91B959; Fri, 26 Jan 2024 13:30:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706275816; cv=none; b=io6ZMDVE6vMclXxJ47h7HOfjk1HRv8T2um9cV1u4tv/QZ5E5lux/PErfBDgqXd4HtZMLChyKfoFuQJ2efYXTY2WjtVce8uJlgTainZBF3LNH54ahgHxv0jy0yjEPaJTvl4lTPgWZC5aVVtVsIINxLTRmLmczcqwTXfk+IlXZywk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706275816; c=relaxed/simple; bh=Nue8KygHkKeII+jOSXsS8scQGO5eZ5Pxo/5p3G7mjZc=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=M4oU59s1I/Pe07wZ2774UA0iCLwt9DOAZZz4II/ApfrY/lqVpmL9pVvUKWqYlzqOrEFn8hNvdKM0U3idWpud0cox9murJB85k7kRetN9W8ooJVorBJzialZYkTnnMMMpZl+gTDNt3L/gRnLnqZ0akeYfrVY3MbRE5nWgc5KMVTo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=IaZc+ud7; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id C2630C43142; Fri, 26 Jan 2024 13:30:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1706275815; bh=Nue8KygHkKeII+jOSXsS8scQGO5eZ5Pxo/5p3G7mjZc=; h=From:To:Cc:Subject:Date:From; b=IaZc+ud7tFfYGt9iESCGtTbgHjNvW0STOVJzOw2Wfcmdo3Viaipm6Yz8VCwWKOUuN HNWBP9OHnlweqoct2SEK8VDPm6U3xs8Wpj2/LFHrldxPAL61/GTMpWuWf4b0t4zEQL Yx2iqVT+tzZ3fFfMsLlkshffQJCbqKfgRVORQMZpLTucSWcckgJ5ej14uJNT3Ci7+2 2QS1DheAIeVXRbJGUsCfXpuRAW+NVN5hs6g5switdlvDt3JTeHR7YzkMj6p6WWkQcU jlulZYAgNrH1fpO0FwpYY+hwdh4ebeGuWYZN4i04zmKly/plLvl9eOMUqI6KQkVA/k hZF6AUXg0sggQ== From: Masahiro Yamada <masahiroy@kernel.org> To: linux-kbuild@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Geert Uytterhoeven <geert+renesas@glider.be>, Yoann Congal <yoann.congal@smile.fr>, Masahiro Yamada <masahiroy@kernel.org> Subject: [PATCH] kconfig: initialize sym->curr.tri to no for all symbol types again Date: Fri, 26 Jan 2024 22:30:10 +0900 Message-Id: <20240126133010.78999-1-masahiroy@kernel.org> X-Mailer: git-send-email 2.40.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: <linux-kernel.vger.kernel.org> List-Subscribe: <mailto:linux-kernel+subscribe@vger.kernel.org> List-Unsubscribe: <mailto:linux-kernel+unsubscribe@vger.kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1789159885704393812 X-GMAIL-MSGID: 1789159885704393812 |
Series |
kconfig: initialize sym->curr.tri to no for all symbol types again
|
|
Commit Message
Masahiro Yamada
Jan. 26, 2024, 1:30 p.m. UTC
In C programming, a non-zero value is interpreted as true, and a zero
value as false.
Kconfig has never worked like that; only 'bool' and 'tristate' symbols
are properly handled in conditionals. The other types ('int', 'hex',
'string') are always interpreted as false if used in boolean contexts.
Until commit 4e244c10eab3 ("kconfig: remove unneeded symbol_empty
variable") accidentally changed the behavior, the default of
CONFIG_LOG_CPU_MAX_BUF_SHIFT was unconditionally 12, because the 'int'
symbol 'BASE_SMALL' was evaluated as false, hence 'if !BASE_SMALL' was
always true.
You can confirm it as follows:
$ git checkout 4e244c10eab3^
$ make -s ARCH=x86_64 defconfig
$ grep -e LOG_CPU_MAX_BUF_SHIFT -e BASE_SMALL -e BASE_FULL .config
CONFIG_LOG_CPU_MAX_BUF_SHIFT=12
CONFIG_BASE_FULL=y
CONFIG_BASE_SMALL=0
$ make -s ARCH=arm keystone_defconfig
$ grep -e LOG_CPU_MAX_BUF_SHIFT -e BASE_SMALL -e BASE_FULL .config
CONFIG_LOG_CPU_MAX_BUF_SHIFT=12
# CONFIG_BASE_FULL is not set
CONFIG_BASE_SMALL=1
CONFIG_LOG_CPU_MAX_BUF_SHIFT defaults to 12 irrespective of the value
of CONFIG_BASE_SMALL.
Since commit 4e244c10eab3, this is an undefined behavior because
sym_calc_value() stopped setting the sym->curr.tri field for 'int',
'hex', and 'string' symbols.
Commit 23b2899f7f19 ("printk: allow increasing the ring buffer depending
on the number of CPUs") presumably intended the following:
config LOG_CPU_MAX_BUF_SHIFT
int "CPU kernel log buffer size contribution (13 => 8 KB, 17 => 128KB)"
[snip]
default 12 if BASE_SMALL == 0
default 0
But, the correct fixes would potentially impact multiple defconfigs,
hence they should be reviewed in each dedicated subsystem.
Restore the original behavior for now.
Fixes: 4e244c10eab3 ("kconfig: remove unneeded symbol_empty variable")
Reported-by: Geert Uytterhoeven <geert+renesas@glider.be>
Closes: https://lore.kernel.org/all/CAMuHMdWm6u1wX7efZQf=2XUAHascps76YQac6rdnQGhc8nop_Q@mail.gmail.com/
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
---
scripts/kconfig/symbol.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/scripts/kconfig/symbol.c b/scripts/kconfig/symbol.c index f615e2c1e85d..1290c6d2f8c2 100644 --- a/scripts/kconfig/symbol.c +++ b/scripts/kconfig/symbol.c @@ -346,6 +346,8 @@ void sym_calc_value(struct symbol *sym) oldval = sym->curr; + newval.tri = no; + switch (sym->type) { case S_INT: newval.val = "0"; @@ -358,7 +360,7 @@ void sym_calc_value(struct symbol *sym) break; case S_BOOLEAN: case S_TRISTATE: - newval = symbol_no.curr; + newval.val = "n"; break; default: sym->curr.val = sym->name;