From patchwork Mon Nov 26 07:22:48 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 151968 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp5304787ljp; Sun, 25 Nov 2018 23:24:44 -0800 (PST) X-Google-Smtp-Source: AJdET5e815Oj/3ZJ2ou0CZgRXuVLX0hw4bnTYtgf2FbfP2+s4SxUYWilRZt3J4AE6mlOARRUvXxA X-Received: by 2002:a62:3305:: with SMTP id z5mr27160837pfz.112.1543217084315; Sun, 25 Nov 2018 23:24:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543217084; cv=none; d=google.com; s=arc-20160816; b=uAFPy2unHcKKbrr9a3TsXX5eIJ/Dbxo0OXL845VqRV5pnwr1MbttBqoo1N3s1guiad 2cETgfevJR+nXNAnPTcfiOlHqf5dZwmhPH3MtJRk+2c+p2Z9SdvR4IaLiGX/6ubfHZlQ /phdzAp7gfjVsq0lRGXAHZSANDuWdPBpB5oYxuvYUtxvF/jfjUz4HbwnEIt4Zvv0AK89 nUsdHBjJ6AixLBobrfMfvp9W/PMCCoBqXmVqzcOHdwImETZpW6eug2SDh9neJlBfGbRg wIF5gTKmcj8EDMRKmqPFrbblfDc0Wxa5+KbuQWIDVDhy8yIIQ1ND9g89ONkZn2/N1vyF FFlA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature:dkim-filter; bh=EVlnJuD564s3iKhkGNA25MnT6jwnG/kSDI2uoW+5WsM=; b=q2mo9XC6Sg87od8NBgmyQRNYTOtRuQueN4UL3EqhK7ahGErqQ9BTaFMGSx7MBwovfk +6G1ayR5c6379LfumNyK9JVOHW5Mrh2FDS+hD9nZvZjmBYnb+zrah8B7ORJiAeYMINB6 Fy0qa1JEJ6+UTeWUhXDxmX66nMy27osqVfG3b7R5Ymahk7eLWUIWciey3wmm0JTyb2Wo K1Np8ReswvaurcrsqXRvEF/OzlSev/ozQ0D5yaPGNHwVwPZj7sxb2M9ppVvKkc0Su2iJ FG3ptH5T46XRnbLwfehLC/jxi0izvs0Ob5EKBGD1QYOXnRGEhuV/qmhut/1kCsPdHVRH 4ZNQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b="jzy/6IZK"; 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 b19si40006183pfm.100.2018.11.25.23.24.43; Sun, 25 Nov 2018 23:24:44 -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=@nifty.com header.s=dec2015msa header.b="jzy/6IZK"; 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 S1726298AbeKZSRy (ORCPT + 32 others); Mon, 26 Nov 2018 13:17:54 -0500 Received: from conuserg-12.nifty.com ([210.131.2.79]:38329 "EHLO conuserg-12.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726158AbeKZSRy (ORCPT ); Mon, 26 Nov 2018 13:17:54 -0500 Received: from pug.e01.socionext.com (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-12.nifty.com with ESMTP id wAQ7N1v2019779; Mon, 26 Nov 2018 16:23:02 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-12.nifty.com wAQ7N1v2019779 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1543216982; bh=EVlnJuD564s3iKhkGNA25MnT6jwnG/kSDI2uoW+5WsM=; h=From:To:Cc:Subject:Date:From; b=jzy/6IZKekAZkco1m0zRyaD4FBymgARBDn01NvHInhugJ6o7Nh0B4T6ABOGqjz13p x3GW0hHIGfuoVW9/CL83XrRY19O9dU7crPDyhxwUvx/ABtx5Fn7D2/xCAc+kco1wdU 36b9PPF8AlAW7x3Dzngg+6exrgIB3evh6smy1SIhPFZ5IQTqPTNH2ICpfLorOQBQrZ r0nXl0M28EOETsqb8GRAvnL8OirWjmEfuCjJYTI0HK035w/kSERLUk6NA6j7T/jIps RT2nfpp72NL4wXe3V8iZDhrj8E2YfdttOU38EL7yxSjKcOK3TJBn2BTe8gnzHN3ViG 4Ok35jmCo1MXA== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: Ulf Magnusson , Randy Dunlap , Taehee Yoo , Masahiro Yamada , linux-kernel@vger.kernel.org Subject: [PATCH 1/2] kconfig: fix reverse dependency with tristate if-conditional Date: Mon, 26 Nov 2018 16:22:48 +0900 Message-Id: <1543216969-2227-1-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org A Kconfig property can have an optional if-expression, which describes its visibility. The property is visible when the if-expression part is evaluated to 'y' or 'm'. The 'select' and 'imply' properties are internally converted to reverse dependencies, but they are wrongly converted if they have a tristate if-expression. Example: config A tristate "a" config B tristate "b" select A if C config C tristate "c" Currently, the reverse dependency of 'A' results in 'B && C'. It is incorrect because the combination of B=y and C=m allows 'A' to become 'm', while its lower limit must be 'y'. The reverse dependency should be 'B && C != n'. Randy Dunlap reported that people are trying to fix an individual Kconfig file [1], and I also found another example in the past, commit 9d9c98e89ee2 ("pcmcia: fix yenta dependency on PCCARD_NONSTATIC") but I suspect this is a bug of Kconfig itself. [1] https://www.spinics.net/lists/netfilter-devel/msg56985.html Reported-by: Taehee Yoo Reported-by: Randy Dunlap Signed-off-by: Masahiro Yamada --- scripts/kconfig/menu.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) -- 2.7.4 diff --git a/scripts/kconfig/menu.c b/scripts/kconfig/menu.c index 4cf15d4..2b18833 100644 --- a/scripts/kconfig/menu.c +++ b/scripts/kconfig/menu.c @@ -401,11 +401,13 @@ void menu_finalize(struct menu *parent) if (prop->type == P_SELECT) { struct symbol *es = prop_get_symbol(prop); es->rev_dep.expr = expr_alloc_or(es->rev_dep.expr, - expr_alloc_and(expr_alloc_symbol(menu->sym), expr_copy(dep))); + expr_alloc_and(expr_alloc_symbol(menu->sym), + expr_trans_compare(dep, E_UNEQUAL, &symbol_no))); } else if (prop->type == P_IMPLY) { struct symbol *es = prop_get_symbol(prop); es->implied.expr = expr_alloc_or(es->implied.expr, - expr_alloc_and(expr_alloc_symbol(menu->sym), expr_copy(dep))); + expr_alloc_and(expr_alloc_symbol(menu->sym), + expr_trans_compare(dep, E_UNEQUAL, &symbol_no))); } } }