Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp1753315ybl; Sat, 11 Jan 2020 02:07:46 -0800 (PST) X-Google-Smtp-Source: APXvYqx4T+I8uVgeTpd4ZcB19Y1fhkkh6+722J+kW3f1/64keWE/V0NRlbYXZkr7DIw9+eg0h0yP X-Received: by 2002:a9d:6849:: with SMTP id c9mr6557776oto.206.1578737266347; Sat, 11 Jan 2020 02:07:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1578737266; cv=none; d=google.com; s=arc-20160816; b=e/FuLLoI9wyqs1hxLzY/VTod1i2suT3XIBH4049RWeGzLn7eLxKkdccv0zJ4xLTDmN dPJc9RawOWybByJB+GhLSWF1rabThQCQEISQ4LSXWGGsDa7sP76s0V65MpT7UpAq5ECv LLhvRlLQF0uBx9eR99kOo4TcVn9SlWLXVqxPbNssz7y1qkuplfHnKl3q0aOV5gJinYsh tGMqY7i5WeRsnFs9YSHC0ScQ0E5x4/hEFZBrjOyIy0pRgMERR159Pok5YLQBreDSR7/I F6c5EUodtDuvU+zgMaRxyZBnXQoyLZodR7A0xeHSINFNpSOTL0YIkVYslyMdHtPTtL3f 8Tig== 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=bGEnxc3OiELcRmyvNp4LW6jsEhZWkysbUX1Jj4yTpT0=; b=pWrTKXrKtYh2bU1iCFwt8NPlw2Xl7VzUtrZwW41k9vt8TXmjjzwt6BVpqM90UZjAD/ rm2LhNIx147kb8aayzz7gc41wuVq1bPtDqhFSvmD28SCadzx2KPaHDQQkZ4w2EEUxX88 9B0ci88haueEy00KWjzcRuX1kykXP2naM90uPIBhsP0ZP8YZG6IeTtQdHHDikU7WOLpD DS8oljCuC75Bpz5UfwsyOfRrA8ea/cnhtVEiwFrtl7f59IdB58RRVlDoX1jAiFr16ZWf f4xSl5P2M4pbLE+JesjL1hryhn5Ztx+P6q0N08NSVbqRz5Gl1ApfSr77ZZvsd7IfMb6F 8/mA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=nMOz6+B2; 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 v26si3478855otj.0.2020.01.11.02.07.34; Sat, 11 Jan 2020 02:07:46 -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=nMOz6+B2; 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 S1729598AbgAKKFm (ORCPT + 99 others); Sat, 11 Jan 2020 05:05:42 -0500 Received: from mail.kernel.org ([198.145.29.99]:39012 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728850AbgAKKFm (ORCPT ); Sat, 11 Jan 2020 05:05:42 -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 07FBB2082E; Sat, 11 Jan 2020 10:05:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578737141; bh=CML4ynmYXN0xB1zt3WrGElGGQONxilXaUfFuXX/uags=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nMOz6+B2hAcrS88BRiIfUBT9n6p6My3PiPtdDZwvMYtTkrRTD0W+YSm0hAb81XOz9 Ar/UHzXUZnHAYo3BEs1FYDBhydKhfZfGKq6eZBGriRaAlr42KhwdYb8Crr/4+ojIhd xsJcH6NqzhZnpu53RwHp01VLMaMWUP0H0FePjOuk= 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 4.9 74/91] kconfig: dont crash on NULL expressions in expr_eq() Date: Sat, 11 Jan 2020 10:50:07 +0100 Message-Id: <20200111094911.443916963@linuxfoundation.org> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200111094844.748507863@linuxfoundation.org> References: <20200111094844.748507863@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 ed29bad1f03a..96420b620963 100644 --- a/scripts/kconfig/expr.c +++ b/scripts/kconfig/expr.c @@ -201,6 +201,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