Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp1776628pxv; Fri, 25 Jun 2021 23:45:50 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzUbFyywaRrz0ww/bNtvcKluRr/VckDB8rQCtpaw32FTqdwU2aNJmqJjKFWa89ZaqwQTEo4 X-Received: by 2002:a05:6402:14ca:: with SMTP id f10mr20038816edx.141.1624689950325; Fri, 25 Jun 2021 23:45:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624689950; cv=none; d=google.com; s=arc-20160816; b=AmJAp8H9z42d3Sq55UWsvENf1BKcr8cpGG5DozQzN4CPGN/myE1mlIvbJbaGrTUQEM WMpzaEmjzaDWy6PO7NwMuzQkrwgpdJyXMAoayBmxuL6fLZvFE3qmEwmTYxrnMU4Y0Crn mY5MWYczlTq34MrrejEYyhbPzFpUx0v6y7OqX+cwwlzrUE5Su/E2eN19KR7Kq0ZR6A5r bRvsa2clr2JK3IM6GoakvAIFN0jObJyAv0vfqfnPmTAfhkwolaVz7QxMRk4iTQcEpMLe F+z2Hkr17Z8hd7MfUY6c55ekILdd+CSyWJm4scKoqbb039jn535ngjS1MyxqP404UetG 4NiQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=dVgzgypy3I4vyZa0CC1LNit8ZRjGCA/6UvyisA1I/pA=; b=0BEKnzSDQLXrL/GMGWDd+TKeU3n31OAuDbrhrpnyj5w73zGOanKXM242axnymdl1Dx eDkwExKPug0t9EW0MEsI4+jw7EGkixXTxXfV9iYWcV2fTzFXWIfUNlmSBGJQHNt+QVlR Klik6gSnS7mfs7t4rdVFno5QK4FcXmJnZfacpvRFJKPBN2dGrbRVJfJgkXAqbeDP+59B ZgW8aB3hH/FYGIs9+v53O/jbLICo0T9a4DNntCDyDmxIW5ATaeGppVupafc4BqwjGE6y 8XsGwKXDUba8Y0KviSxaEzmhi/a51AujRoMNZEqROF5cR3z3e+7U1waYmOQPiOCJ5IsV N+YQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=bWZ+08uR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id hg8si6951574ejc.662.2021.06.25.23.45.20; Fri, 25 Jun 2021 23:45:50 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=bWZ+08uR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229630AbhFZGn0 (ORCPT + 99 others); Sat, 26 Jun 2021 02:43:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45136 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229518AbhFZGnZ (ORCPT ); Sat, 26 Jun 2021 02:43:25 -0400 Received: from mail-wr1-x436.google.com (mail-wr1-x436.google.com [IPv6:2a00:1450:4864:20::436]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CCC07C061574 for ; Fri, 25 Jun 2021 23:41:03 -0700 (PDT) Received: by mail-wr1-x436.google.com with SMTP id i94so13203688wri.4 for ; Fri, 25 Jun 2021 23:41:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=dVgzgypy3I4vyZa0CC1LNit8ZRjGCA/6UvyisA1I/pA=; b=bWZ+08uRS0bqS9b2VzHhkNwZZC2wRFzwatNGEemyWd0YCXdj7bIA8VXm+0RecadiR5 uOKI0/qEvKEAvdDgfRsFnY24d/kWrgW8u7gFD0IzBScuoFrP77uthKLaUHMzWF7SuMMf F0CoXy8X3TLbS57RQnSIqeNISejt88v+vNa+dLqLg1T5qGKCQ7hze25GQdAFm1KnaQ9x rpL46/N66bbL7pLwK0KZEED7149lun4ckAld22NvlIsTHmgngTxP9ng725L/sdSfwOzd iPsLtUTRlg9eov4XaamghjFIjX9EUqqSoXzTgwg8zJnufGnLKXdd7JP7G6rO3In8Tctw qCCQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=dVgzgypy3I4vyZa0CC1LNit8ZRjGCA/6UvyisA1I/pA=; b=VOPzP542HqwLc9E3nd993egXGv+m+b5a8BMUlwXmC5/cXpxZB2ijsGP0UaVgTLAG3p w2p40CPlbLUJP5n4Yay/CshvHi02MNQ+jmRVGqhgmvWdBDq7/E7WH0lWUWy7WgzRC+FT 3NqShlUYG4cGGXgdzBwkYvMbiV8eGDbXdvds5N+8CfJOIGAblw7r9Fe78NZmijbHIK6N oFqaU08/MA5pGjIMNOhDByVR/uf6dQJb4Y5jtND5guzP6aBOzxtS0ezFa/1420T0YiWl kbNW3oSdOFpOcOdEaJ+AbUNcp8ysPzJU7p9XxLzIpPbyN1r8l+CYkVu24KVMIm0ZVcQT vFHA== X-Gm-Message-State: AOAM532YKf4ERbCelqUKCtw+YDKEzNBooKNuWiO1pW8/9rwgdddGI1GM SK5dTIryDiuMqHjnAhCRaA== X-Received: by 2002:a5d:48c6:: with SMTP id p6mr15518937wrs.45.1624689661925; Fri, 25 Jun 2021 23:41:01 -0700 (PDT) Received: from localhost.localdomain ([46.53.254.84]) by smtp.gmail.com with ESMTPSA id s1sm13350194wmj.8.2021.06.25.23.41.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 25 Jun 2021 23:41:01 -0700 (PDT) Date: Sat, 26 Jun 2021 09:40:59 +0300 From: Alexey Dobriyan To: Andrew Morton Cc: linux-kernel@vger.kernel.org, Miguel Ojeda , Al Viro , Linus Torvalds Subject: Re: [PATCH v2] ELF: add and use SUPPRESS_WARN_UNUSED_RESULT Message-ID: References: <20210625163040.a15af04872959da9af161fca@linux-foundation.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20210625163040.a15af04872959da9af161fca@linux-foundation.org> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jun 25, 2021 at 04:30:40PM -0700, Andrew Morton wrote: > On Sat, 26 Jun 2021 00:13:12 +0300 Alexey Dobriyan wrote: > > > Last write to the "error" variable in load_elf_binary() is dead write. > > > > Add and use SUPPRESS_WARN_UNUSED_RESULT macro to express intent better. > > > > Credit goes to Ed Catmur: > > > > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66425#c34 > > > > Macro doesn't work for WUR functions returning structures and unions, > > but it will work when gcc copies clang. > > > > ... > > > > #define __must_check __attribute__((__warn_unused_result__)) > > +/* > > + * "(void)" is enough for clang but not for gcc. > > + */ > > +#define SUPPRESS_WARN_UNUSED_RESULT (void)! > > That macro is rather ugly. Hopefully we won't really need it - how > many such sites are there in a full kernel build anyway? I don't know really. And they're hard to find because "(void)" doesn't work and not everything is marked as WUR. copy_from_user/copy_to_user are WUR but get_user/put_user aren't. Logically they should bed. And if put_user() is WUR then I know another place inside fork: if (clone_flags & CLONE_PARENT_SETTID) put_user(nr, args->parent_tid);