Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp1744479ybl; Sat, 11 Jan 2020 01:57:37 -0800 (PST) X-Google-Smtp-Source: APXvYqyrB5weWCcuFXkGU26gXjm07RRAFSX33sXiTPNbbrkRrRtK6QE/o4pA/hT7MCGQXoxhvMVm X-Received: by 2002:a05:6830:11d2:: with SMTP id v18mr6594402otq.151.1578736657058; Sat, 11 Jan 2020 01:57:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1578736657; cv=none; d=google.com; s=arc-20160816; b=dvsazOcp1IpxOXT9jZyekfC56T0yqhm9fYApQGVlYyj6eFmNtTjOC8Pthd6OSTzaI4 KMpEYEWnFqPSJXCIGJoutHBVp5ocq64BwKcIhCdI97Jjq+gOdfaIpd50LLlzAekQ/Xj9 zaXJ+MJ3eZGyy7/Cznk3DYL8KUkeYmIpFzWMQXBX5SL8ix+eeUpgY/Jnt+5ctNs6NAFy kw++qwPMHvgHKtq8DU8bYNuMjsTtKVaAUC4oaROBxtf6pZIjCMfP2h80xHgxWPmXf4n3 UbM7khoLaz+4K2XrRIddsJfw/CkOhjH3muy0Vv2nfY6SLZ9IBITC5xGRFZKozssmlMIb pY9g== 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=RKfLxeJoHYIp4aPTTRQ2fCx47KN3l4N9AeGhUOlGVT0u2Bw7XIxMZAJNO9COC1ILe6 IRZjxxnObjJ7qdINM4aROqKzuoZVUd2mY03JqUnDUKkORpeh6AdQ2g3j26VO7rlRRaaY OAhvzY7sMPXTmUwBKk5ZtxXQbkSeBtswvx/+KGqSBNj5UA+UVgAa8ybZ+jpvKrkiFm21 acv19EBoZNgyj8Is4VgznqM4Df5/j336nU/9QokJ5PZ46duEAeQTTuX+xd1MncqLRzoX C7IS7ZtIhcBt2O6vqoTmi+7R7wI1Q+kez9nzn7rjh/V/KE/0rgaKB1YvYeOhh3orvj2R UVDw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=lYsLkWFB; 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 d22si3545402oti.316.2020.01.11.01.57.21; Sat, 11 Jan 2020 01:57:37 -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=lYsLkWFB; 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 S1729120AbgAKJzb (ORCPT + 99 others); Sat, 11 Jan 2020 04:55:31 -0500 Received: from mail.kernel.org ([198.145.29.99]:45520 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729073AbgAKJza (ORCPT ); Sat, 11 Jan 2020 04:55:30 -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 06CF42077C; Sat, 11 Jan 2020 09:55:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578736529; bh=CML4ynmYXN0xB1zt3WrGElGGQONxilXaUfFuXX/uags=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lYsLkWFBJXQbOM9+W54CSGGX9XwIBQYM6A+jlLDQNYOM/k7OLckoJZwB6oDlVuLoA REvxJBZTS4GnnKIzBYeRmyBVh8OL6wnQ6F+O+gEhFccgSoJIlyyjm+wdhY3b06Ljto 147qeMhldEWuDUJkStiO3FzU8yBYou9cVOQgafT8= 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.4 46/59] kconfig: dont crash on NULL expressions in expr_eq() Date: Sat, 11 Jan 2020 10:49:55 +0100 Message-Id: <20200111094848.177582237@linuxfoundation.org> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200111094835.417654274@linuxfoundation.org> References: <20200111094835.417654274@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