Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp1770523ybl; Sat, 11 Jan 2020 02:28:34 -0800 (PST) X-Google-Smtp-Source: APXvYqwEo1T2I5cSD4o4mOLSDokZZFIEQL9p0dSA+yvksvzVEQ7ymFVhDiaPOnEeQ7DQYzPl8Nxy X-Received: by 2002:a9d:478:: with SMTP id 111mr6156042otc.359.1578738514713; Sat, 11 Jan 2020 02:28:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1578738514; cv=none; d=google.com; s=arc-20160816; b=tZ5igABBCQK/u5pAXinvC0m6S51oyFPL0Xv0c4IPTLxvBUOuG3oK+V7bwnuaVJ+tST urpDvo6ypYJCh4RHQ5CdfLZ5hyqcz9z6Jc4yeczcYKtgVgBsUgqrb5h84eKEDganC1iL MoMU/9gGbclAb4GQ4UlI2hgkajerFME+bjyf5/KxPeF15mzdNH8B3t5lLnq6xwPi22VZ f9WpY1aMWbQyNN6i1qZ56rMd2nr7oOih0rk5+q6VctucVqdSTIBUCn8Z1epaKunaKAMU ykoU/2jMsxt3PWDuhp4VF3W4LokZuv894/YfHSx9dxFtEi9Ql9/h/Ty56zWH8PeE9Dxq k7Fw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=EagCheLzmzgnsMuM/zA6DSWXONagUFII6QRAL+LSD+Q=; b=lGZlgVQUePlY+d9VzSb/cPEad9ca9y1LhiVwy9xHRS7c+Ow7qpOmoYheNbICnOzLx1 wMFf4vwZZbLFs7Tst8FJ60f3sIek/rVb75vgxgTSUtAMEZukSM8d5NluzjvjE+n8IaeX gHlGcwUjCcsLU1eHfYud7sHEWtfbPXcC6eQW3DkanGgw12PyGPBzLQbTDvybMrxC1MxG h7fOd8rfC/3utvyhq9Mw8OmSZ5v0oJQNDIMFsjWwB9Q+vx7PLnqFowXslJomKsZqm+Yx iWmgNeslWLwDbwbagE0iKJffeoZHrmco1EuT2p8ZIW7P6qsSvCoydj25EcGd1aFBTf/g KXug== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="x/VHK50Z"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l2si3226932oti.303.2020.01.11.02.28.22; Sat, 11 Jan 2020 02:28:34 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="x/VHK50Z"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731071AbgAKK1c (ORCPT + 99 others); Sat, 11 Jan 2020 05:27:32 -0500 Received: from mail.kernel.org ([198.145.29.99]:33488 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730369AbgAKK1b (ORCPT ); Sat, 11 Jan 2020 05:27:31 -0500 Received: from localhost (unknown [62.119.166.9]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id F1F8C2082E; Sat, 11 Jan 2020 10:27:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578738450; bh=WVrp7kpSwaN3E2DQOEWjNnna9bWepczGG6U1C3xO4DQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=x/VHK50Z1ik44l80iugrXHNVVaYAEE56x0Wj6qJ5DXoMWgmYSxmzo+nMuQy3B1Jdw xx/nTLYv+bHnOeit6WIdaPDWNohaq0aSNrWaFOJGnrofQy5X1SC3DVPWE3vLly2niZ l5vVKLA8WsTTxphv0rPt/9obeD8oPn5rihvj0NRY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Thomas Hebb , Masahiro Yamada , Sasha Levin Subject: [PATCH 5.4 096/165] kconfig: dont crash on NULL expressions in expr_eq() Date: Sat, 11 Jan 2020 10:50:15 +0100 Message-Id: <20200111094929.687953100@linuxfoundation.org> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200111094921.347491861@linuxfoundation.org> References: <20200111094921.347491861@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Thomas Hebb [ Upstream commit 272a72103012862e3a24ea06635253ead0b6e808 ] NULL expressions are taken to always be true, as implemented by the expr_is_yes() macro and by several other functions in expr.c. As such, they ought to be valid inputs to expr_eq(), which compares two expressions. Signed-off-by: Thomas Hebb Signed-off-by: Masahiro Yamada Signed-off-by: Sasha Levin --- scripts/kconfig/expr.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/scripts/kconfig/expr.c b/scripts/kconfig/expr.c index 77ffff3a053c..9f1de58e9f0c 100644 --- a/scripts/kconfig/expr.c +++ b/scripts/kconfig/expr.c @@ -254,6 +254,13 @@ static int expr_eq(struct expr *e1, struct expr *e2) { int res, old_count; + /* + * A NULL expr is taken to be yes, but there's also a different way to + * represent yes. expr_is_yes() checks for either representation. + */ + if (!e1 || !e2) + return expr_is_yes(e1) && expr_is_yes(e2); + if (e1->type != e2->type) return 0; switch (e1->type) { -- 2.20.1