Received: by 2002:a05:6500:1b45:b0:1f5:f2ab:c469 with SMTP id cz5csp543375lqb; Wed, 17 Apr 2024 04:23:34 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCW9GDlhG9dUjGhISkEQ1RQ3e5PI7vL+ISskPzPJ8PsFl6en7/IQFmAj2CgPSXOeSrp9Ylkw+enHw0XduYBQWzdCB4XFJdZL+SvirQvoYQ== X-Google-Smtp-Source: AGHT+IH8mdds3EAazxKoKGTwjdexaOoyQHXq5Dx5EPcnSWd5+96xgafoYwxUIkSmYRXMnZiibBQI X-Received: by 2002:a17:906:245a:b0:a51:91fb:efb1 with SMTP id a26-20020a170906245a00b00a5191fbefb1mr9955188ejb.72.1713353014019; Wed, 17 Apr 2024 04:23:34 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713353014; cv=pass; d=google.com; s=arc-20160816; b=LGL+FDEjELRIfxvJsX4WZw4d31XvGCMV3rpcp+JDFCmgW8cuTFrYUysiV29gt7JsrD ITsLvhA4sG4IrUIbd8jNwSJpV8saiv10VK4ianjAwKHirXVFVHF5xo2RK6Lnfs44pR7r StTuAfjUS4p10akxNPgtIhKGGYqqeJO7/KYizZOeBo2te/njHt0clTezdZnF3YmLbrON fG89KA5ENqaxb1FwMExf1fzOk/EY+yfooFyUff8DSjeXt+XeLlmWiItPd2rzQIWucFFs mLsN0b9XHbYCP0g2+BFTkrpkQhYEOo3mx6abQYSv0HjetEO8mv/hd5cQPoarOPkEZBfF VYGw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:sender:dkim-signature; bh=9WUQ8LhAsMpwwq/+rPAvVmYYIR8bLgyILBO1ofwpQzI=; fh=C86hE42kkaSgTZ7jXawLbhNdlOExtm4TqphohEwZLQ8=; b=DAGeDSq1aQF9d5q6I7b0wXnn3BRPqulH3gLi3RhA5BXcfT4iYZajGXirlRq8fGWoLX qr3Bm+mhnrFidR3IWCq/bYhDbcv2DwcYI8A7GFC840lDw11+ZH9B2MyFDnor7I4ASewK hamWx/2WxZgYMo1KlZG3chLJNzllw/NLWxzxsH3CGQW37fgKjDf2G6uUE5aIZgE+Fjlj mdzXuM9EfQgkCG+RSl/IBrrEmZAlcczqNCgUl851lgKRWnuZgoSMA6iggZzhmx3htBzc 6KbhztBQ9pR0uZ3b3HnkWsDZMs5rby79yBjoOK9IJRlvVreDiqo38gbDEDoSr7FH6bRM pQLQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=k0xCc+NJ; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-148400-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-148400-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id k14-20020a1709065fce00b00a522e903c5csi5809916ejv.882.2024.04.17.04.23.33 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Apr 2024 04:23:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-148400-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=k0xCc+NJ; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-148400-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-148400-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id BCE471F243FD for ; Wed, 17 Apr 2024 11:23:33 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 76A0913C9A3; Wed, 17 Apr 2024 11:23:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="k0xCc+NJ" Received: from mail-wm1-f42.google.com (mail-wm1-f42.google.com [209.85.128.42]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1AD6413C80E for ; Wed, 17 Apr 2024 11:23:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.42 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713353005; cv=none; b=Aea96Nv16md6z3H1lsrtMu2krWTesXRzWkSJpV/TiLDoZS86cyG6iACG66YFxJJgMgm/S/AjfbNzjZVQb0z2m2oJSmB8bcmfxhESg0c4nJBoDisoz6X0hi5SBFWrnG5FkaINi3/n0XSfQ8LeGH8XHDUN8HV+c+19Xp3j/GReC8Y= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713353005; c=relaxed/simple; bh=KPx2ZsqWpzZLK3m3WMgWg1Tq0M4fucX/fotRCnYiRgQ=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=DFLLIpxjDGkCgzPOct5JBgV746lqxCdKdUwznbWhmj+LjBEPawQJ/7asMNyKkeQtsTP5n9fexe4wxh2cIAIDTmScr8AWP/Y4tNkuLEGDmdi/hHQZZuxw6QrqVMGBXq6wbTTUu2i111upwM6UtqB58QjIaTbs9BiZOWULV5xDnrQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=k0xCc+NJ; arc=none smtp.client-ip=209.85.128.42 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-wm1-f42.google.com with SMTP id 5b1f17b1804b1-4187981999fso17862555e9.1 for ; Wed, 17 Apr 2024 04:23:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1713353002; x=1713957802; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:sender:from:to:cc:subject:date:message-id :reply-to; bh=9WUQ8LhAsMpwwq/+rPAvVmYYIR8bLgyILBO1ofwpQzI=; b=k0xCc+NJ66obQpGJSfZLqkLOnH0FHj7kHKofkTpOcYnbVjmvTfjbcbYWW0GOpuWIus qyr/RTzx+zCcEZQLTUspSA52NoRfHvo9X/Izx8ViYJREeFK8UpUhEFoxkQKfXel457kD o/Qb0wqrBFLX3IBNLCQAIW4RNAlQO8gZlUPyFEOSGwbFsTUlpqmNQy2ieIJFPvKZS3i+ fBUmjLqQZhtfLzObu0u6Ha8yAj+EXoCh7qIWU2geVoyYp6esV9k486OoTXNv+oExJgjJ T3q2LTE7DadQZGxZywQlK3uHgfxlyKyEzx2cblouRJNMhtQlH+CkW4ewMHhKjbMRLlj+ KLlQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713353002; x=1713957802; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:sender:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=9WUQ8LhAsMpwwq/+rPAvVmYYIR8bLgyILBO1ofwpQzI=; b=oS3VpOU5Vf8TDyb3bNOaAGQrX4Ua98F/6xGPNi6zRdLVNzsqsk8fX4o9bZhl0QGu9h 9MpgxwCb03nFtlh4N2IAA5cbT0BHwmNrvQLH7Z1YfhJ/BzpGqCMTUqINE6JWw7qtRGhq 9SJe/LAR3ePxbDo4AUlA63SJic0kDyTlQCAhyhwQA99Nxe67kQcDBUZ6ti/Fzxhs/5mI UScukGDqSZt2lnwP5tV0GhACOGoYnAZ52PbQxtXyh+DepHOAraQ9lCVV4jU8sRBDsORx +E88ZeQUGyri5XrR96tFydePRG9rlI/xtQHQmN00ipon5hkkitlVRr8iEeNI9+ayRE20 264g== X-Forwarded-Encrypted: i=1; AJvYcCU4h6gDCghokZo08JEAVRw08y7Sf0IUjl7SuG7WuCxNViHXXTpkGqyVfmujLAYEygRlYNuX6ABv9d83lw+C0h/7TvGf6TrB4oOSul7O X-Gm-Message-State: AOJu0YwB2oaKIl37DXhS5RxQE6DlJZP9v9nj/hke2lVHkXdGgdmT6hjz 6+U0l2V7Ubu2KGTcFOLDufpRK9THfZnmOkhfUMY+KBl7XBwkMjRU X-Received: by 2002:a05:600c:46d0:b0:418:676d:2a51 with SMTP id q16-20020a05600c46d000b00418676d2a51mr5249443wmo.15.1713353001837; Wed, 17 Apr 2024 04:23:21 -0700 (PDT) Received: from gmail.com (1F2EF007.nat.pool.telekom.hu. [31.46.240.7]) by smtp.gmail.com with ESMTPSA id cg17-20020a5d5cd1000000b0033e7a102cfesm14397193wrb.64.2024.04.17.04.23.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Apr 2024 04:23:20 -0700 (PDT) Sender: Ingo Molnar Date: Wed, 17 Apr 2024 13:23:18 +0200 From: Ingo Molnar To: Matthew Wilcox Cc: Linus Torvalds , Kees Cook , Ingo Molnar , Peter Zijlstra , Juri Lelli , Vincent Guittot , Dietmar Eggemann , Steven Rostedt , Ben Segall , Mel Gorman , Daniel Bristot de Oliveira , linux-kernel@vger.kernel.org Subject: Re: [PATCH 00/19] Enable -Wshadow=local for kernel/sched Message-ID: References: <20220302043451.2441320-1-willy@infradead.org> <202404161413.8B4810C5@keescook> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: * Matthew Wilcox wrote: > On Tue, Apr 16, 2024 at 05:29:02PM -0700, Linus Torvalds wrote: > > On Tue, 16 Apr 2024 at 14:15, Kees Cook wrote: > > > > > > I was looking at -Wshadow=local again, and remembered this series. It > > > sounded like things were close, but a tweak was needed. What would be > > > next to get this working? > > > > So what is the solution to > > > > #define MAX(a,b) ({ \ > > typeof(a) __a = (a); \ > > typeof(b) __b = (b); \ > > __a > __b ? __a : __b; \ > > }) > > #define __MAX(a, __a, b, __b) ({ \ > typeof(a) __a = (a); \ > typeof(b) __b = (b); \ > __a > __b ? __a : __b; \ > }) > > #define MAX(a, b) __MAX(a, UNIQUE_ID(a), b, UNIQUE_ID(b)) > > At least, I think that was the plan. This was two years ago and I've > mostly forgotten. I think as long as we can keep any additional complexity inside macros it would be acceptable, at least from the scheduler's POV. A UNIQUE_ID() layer of indirection for names doesn't sound look a too high price. I had good reasults with -Wshadow in user-space projects: once the false positives got ironed out, the vast percentage of new warnings was for genuinely problematic new code. But they rarely used block-nested macros like the kernel does. Thanks, Ingo