Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp3479241pxp; Tue, 8 Mar 2022 15:30:58 -0800 (PST) X-Google-Smtp-Source: ABdhPJwgM0AzLHUpu9fJBE+A/f5jub7jWDYjKz5U0ziAyOOAp1AQOLmUy4oeMZBzpiHKuPFD3AYN X-Received: by 2002:a63:1665:0:b0:378:ba21:ddb9 with SMTP id 37-20020a631665000000b00378ba21ddb9mr15842557pgw.268.1646782258795; Tue, 08 Mar 2022 15:30:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646782258; cv=none; d=google.com; s=arc-20160816; b=QrjMUUOWbkaunSFGM40mhADia7wuu4DLcE3cnVzFZJAX7XMmBqrUfNM9hQ7lWjHFVi atSONUqQNtDfq9wBGVJZ/0KsPLHlxWE+r16KJgQkYAE1oQI7uMcNEZZEjt8bIGdQhst5 TQzLx/c2rOKmqdx3H4/4bLROWTpgSE7qMoOEG4/HV7bpfrcMYw1T2wIsV8ZxM/4Nk31e qR1BpuIrjJNRGhy+XpZYs3P0GMQ4mdmmE3dYS99EWN9SbXAlujdNfLF+pkndkfDC/Nor yHdJmzmb6rY8ZbW5yU8UazlWeWZq5YXj0vkfv4ZDSlElxMH/FiZMSm2gfCN544eObSko zTcA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version; bh=JapVBA42ANAFaik/R5R8oQrdBborYpBMhsREvW8QUhg=; b=FArEtuPd9gbh7FZSdfYudfxgvV6CA5bZXNkrdV9+PEYrBI9d6zpRGNmp5HdNda3MVg gIHKoN6L9yPMuNdWXk4ZJHUTKGw+UZVzR7gLbx/UNrExPxZ3tYVj5f+Fruo9xDxjZpee hSwIkkAAizqWW3QVWuRcvA0GqrbIw4wt7MME69Ooq1eR8m0O9yLe/pfKuljPr6OPeQzI vb48vDY36jx7QQTyC+ieNquHkrdNOiiGZzAQ3Z//S1pvKn7+dgu3vOC27VwdRS/Z0gwq 4XDXIbb1oc3A4uGIG1eq9QAKj9Pp8HfHimXrI5e6FPHKePwjpvE1Gcl8/3HZQZDCCMVY 4DRg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id i1-20020a6551c1000000b00373cc0b5fd5si214661pgq.305.2022.03.08.15.30.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 08 Mar 2022 15:30:58 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 8B45EA4190; Tue, 8 Mar 2022 15:19:46 -0800 (PST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239859AbiCGNwF (ORCPT + 99 others); Mon, 7 Mar 2022 08:52:05 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57896 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237571AbiCGNwE (ORCPT ); Mon, 7 Mar 2022 08:52:04 -0500 Received: from mail-yb1-f182.google.com (mail-yb1-f182.google.com [209.85.219.182]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 92C588BF55 for ; Mon, 7 Mar 2022 05:51:08 -0800 (PST) Received: by mail-yb1-f182.google.com with SMTP id g1so31052897ybe.4 for ; Mon, 07 Mar 2022 05:51:08 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=JapVBA42ANAFaik/R5R8oQrdBborYpBMhsREvW8QUhg=; b=T0xH5JDXg32O0/V+GFnmg9vPSXCp++Plln+RZx3Vh98q8Ig+rxJ/Kr0Qe53mnc26nJ YyFwUKaP8Rmm551Uq0IefU9k1gWYy+XrKYlBV89aKSkOgoPan6LmwBEMuezbi12anvH7 TRAZ6LBvWOdOZj1K9Zi7oUFSWuAE6dee8MkaX2jkPd4ccZyEcnniZ9Pt61XE5tDVkaQ4 yzC/nut9w4e57N6iyIU+icWZHi5rGn1DSxPWTLCdZkXWStg8yNSQlYz0xmKZNob+ukYq TrUDmvztDq+cPeUvhM+DtU91F5PjL6GDQVeZC9TjxtauvdMHB/YhwxhQIdHdY52XicCS ktuQ== X-Gm-Message-State: AOAM530A1AyCvSMKgIoL7is3oMfXz46ss4N3nF4vcIm0tK257Gwb2eiZ f8oGhENtbAz4Ebexg/9j0Qv9QOrUKitp5jewq+A= X-Received: by 2002:a25:2685:0:b0:629:1eee:81e1 with SMTP id m127-20020a252685000000b006291eee81e1mr6274535ybm.20.1646661067635; Mon, 07 Mar 2022 05:51:07 -0800 (PST) MIME-Version: 1.0 References: <20220304124416.1181029-1-mailhol.vincent@wanadoo.fr> <20220307105810.1747024-1-alexandr.lobakin@intel.com> In-Reply-To: From: Vincent MAILHOL Date: Mon, 7 Mar 2022 22:50:56 +0900 Message-ID: Subject: Re: [PATCH] linux/bits.h: fix -Wtype-limits warnings in GENMASK_INPUT_CHECK() To: Arnd Bergmann Cc: Alexander Lobakin , Andy Shevchenko , Rikard Falkeborn , Andrew Morton , Linux Kernel Mailing List , Kees Cook Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Arnd and Alexander, Thanks for the support! On Mon. 7 Mar 2022 at 21:15, Arnd Bergmann wrote: > On Mon, Mar 7, 2022 at 11:58 AM Alexander Lobakin > wrote: > > From: Andy Shevchenko > > > Have you fixed W=1 warnings? > > > Without fixing W=1 (which makes much more sense, when used with > > > WERROR=y && COMPILE_TEST=y) this has no value. > > > > How is this connected? > > When I do `make W=2 path/to/my/code`, I want to see the actual code > > problems, not something that comes from the include files. > > When I do `make W=2 path/to/new/code/from/lkml`, I want to see the > > actual new warnings, not something coming from the includes. > > It's much easier to overlook or miss some real warnings when the > > stderr is being flooded by the warnings from the include files. > > I'm aware there are some scripts to compare before/after, but I > > don't want to use them just because "this has to value". > > I don't want to do `make W=2 KCFLAGS='-Wno-shadow -Wno-type-limits'` > > because then I'm not able to spot the actual shadow or type limit > > problems in my/new code. > > I fixed several `-Wshadow` warnings previously in the include files > > related to networking, and *nobody* said "this has no value" or > > NAKed it. And `-Wshadow` has always been in W=2. > > I agree: if we decide that W=2 warnings are completely useless, we should > either remove the option to build a W=2 kernel or remove some of the warning > flags that go into it. My feeling is that both W=2 in general, and the > Wtype-limits have some value, and that reducing the number of W=2 by > 30% as this patch does is a useful goal by itself. > > A different question is whether this particular patch is the best > workaround for the warnings, or if a nicer alternative can be found, > such as moving -Wtype-limits to W=3, I disagree with moving it to W=3 for two reasons: 1/ This would just move the issue elsewhere. If I had to compile with W=3 (which I admittedly *almost* never do), the -Wtype-limits spam would still be there. 2/ After this patch, the number of remaining -Wtype-limits drops to only 431 for an allyesconfig (and I guess that there are a fair amount of true positives here). This warning is not *as broken* as people think. W=2 is a good place I think. That said, moving it to W=3 would still solve the core issue: W=2 being spammed. Definitely not my favorite solution, but still an acceptable consensus for me. > or using an open-coded variant > of __is_constexpr() that includes the comparison in a way that avoids the > warning. This is easier said than done. This is the __is_constexpr() macro: | #define __is_constexpr(x) \ | (sizeof(int) == sizeof(*(8 ? ((void *)((long)(x) * 0l)) : (int *)8))) Good luck doing an open-coded variant of it! What I mean here is that there definitely might be a smarter way than my solution to tackle the issue, but I could not see it. If you have any concrete ideas, please do not hesitate to share :) Yours sincerely, Vincent Mailhol