Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp2375990pxj; Sun, 16 May 2021 23:42:25 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxKueN7AtIQ2PIGIDE0NSurjPU4Ug22K+YWLrS5xrgJSruKQlMCTv6LoUycm7dvAE5IkNHU X-Received: by 2002:a02:2a8c:: with SMTP id w134mr54228718jaw.138.1621233745784; Sun, 16 May 2021 23:42:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621233745; cv=none; d=google.com; s=arc-20160816; b=GvkkRDvJqplKBIGfxKcrIurFqrbm0oE4W3B2OMYnVos16MO3PBxzvxcDEiguD92rsb XF4Y/6/J04bAbbJ3vLJxc6NPaXmSh55eQkRY+NsVQiqPfdGMYAwi2J+h0LVo1sdaZ8Kd TvR+64IoVzObBW0Zuai0/0iT8cXZAfWJbS0555C7+4FWrJoh68VMIk2jxA5ghN4kUBv4 w9xBN53HqJcUoTX8QjYQQ92R1ct4Wnfn5O1g/ximaO0Y3AH0XZGjdRRzqUu9DBT5mfzI Mbzn0omhvqul6l+5iXLSOAhURu+V5HDOWOH6AUuYwldBtNd60fvfnusE1EWdIORjySZW TVsQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:organization:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :ironport-sdr:ironport-sdr; bh=erRUOQYBAnKTliXZwt0Vtyet+y6RFGelj0AHkwf78AU=; b=TfzZVRrf2YaYAXED4ysDFe0NdJzZjglQwRZueDSpwMf9+BMd+2GboR3TkfU8WbfoYs J5K7y9LckgyxOCzwFlCx3FD3i7RB7pYckjgAArhtUd91z7jy65Zn4RppiwCyhU0j6hBF 8Ml7pbvuXqHWgZ/pBVfEEQOZs0ifvmHL3UK8zuj5fUPeJE1wkmxjlTtCjBClMaDF9PwA wK+vK9XA4pvKsdBNgkoxB8qo9NURjhi75ehwCcW4UE13tLHGIJWvEfBBi6emSc8aMdtn Zj2ohPpYyhUGI3rMAMMGvqzqvBa9/PiVu4nrSyxt+EsJxumbpQlP5LH3oYid/THMNEYR S7mQ== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (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 o1si18264389jat.48.2021.05.16.23.42.13; Sun, 16 May 2021 23:42:25 -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; 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=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232331AbhEQG1f (ORCPT + 99 others); Mon, 17 May 2021 02:27:35 -0400 Received: from mga09.intel.com ([134.134.136.24]:28204 "EHLO mga09.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229452AbhEQG1e (ORCPT ); Mon, 17 May 2021 02:27:34 -0400 IronPort-SDR: HrrIJ5xOVLCyqw9arMfMhmtfcbcHLP2CKrkt+A42AGgyrNMdao6U8dzw90OfBC4y7XGwPNu66y /kJxGjRIxk0Q== X-IronPort-AV: E=McAfee;i="6200,9189,9986"; a="200445076" X-IronPort-AV: E=Sophos;i="5.82,306,1613462400"; d="scan'208";a="200445076" Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 May 2021 23:26:18 -0700 IronPort-SDR: GKJ3gEEOt7aDNlLU/7l33fpdt46tZPW0TzR/TUpBQ0I9USmY64iExb2NnPsbAaInIrumEEZmUi 7fOrFSQ/bO+g== X-IronPort-AV: E=Sophos;i="5.82,306,1613462400"; d="scan'208";a="543599351" Received: from smile.fi.intel.com (HELO smile) ([10.237.68.40]) by orsmga004-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 May 2021 23:26:16 -0700 Received: from andy by smile with local (Exim 4.94) (envelope-from ) id 1liWhh-00Cg2E-8B; Mon, 17 May 2021 09:26:13 +0300 Date: Mon, 17 May 2021 09:26:13 +0300 From: Andy Shevchenko To: Arnd Bergmann Cc: Petr Mladek , Rasmus Villemoes , Uwe =?iso-8859-1?Q?Kleine-K=F6nig?= , Arnd Bergmann , Andrew Morton , linux-kernel@vger.kernel.org Subject: Re: [PATCH] [v2] printf: fix errname.c list Message-ID: References: <20210514213456.745039-1-arnd@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210514213456.745039-1-arnd@kernel.org> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, May 14, 2021 at 11:34:50PM +0200, Arnd Bergmann wrote: > From: Arnd Bergmann > > On most architectures, gcc -Wextra warns about the list of error > numbers containing both EDEADLK and EDEADLOCK: > > lib/errname.c:15:67: warning: initialized field overwritten [-Woverride-init] > 15 | #define E(err) [err + BUILD_BUG_ON_ZERO(err <= 0 || err > 300)] = "-" #err > | ^~~ > lib/errname.c:172:2: note: in expansion of macro 'E' > 172 | E(EDEADLK), /* EDEADLOCK */ > | ^ > > On parisc, a similar error happens with -ECANCELLED, which is an > alias for ECANCELED. > > Make the EDEADLK printing conditional on the number being distinct > from EDEADLOCK, and remove the -ECANCELLED bit completely as it > can never be hit. > > To ensure these are correct, add static_assert lines that verify > all the remaining aliases are in fact identical to the canonical > name. Looks good to me, thanks for fixing this. Reviewed-by: Andy Shevchenko > Fixes: 57f5677e535b ("printf: add support for printing symbolic error names") > Cc: Petr Mladek > Suggested-by: Rasmus Villemoes > Signed-off-by: Arnd Bergmann > --- > lib/errname.c | 18 +++++++++++++----- > 1 file changed, 13 insertions(+), 5 deletions(-) > > diff --git a/lib/errname.c b/lib/errname.c > index 05cbf731545f..6c5c0aa4de75 100644 > --- a/lib/errname.c > +++ b/lib/errname.c > @@ -21,6 +21,7 @@ static const char *names_0[] = { > E(EADDRNOTAVAIL), > E(EADV), > E(EAFNOSUPPORT), > + E(EAGAIN), /* EWOULDBLOCK */ > E(EALREADY), > E(EBADE), > E(EBADF), > @@ -38,8 +39,12 @@ static const char *names_0[] = { > E(ECHRNG), > E(ECOMM), > E(ECONNABORTED), > + E(ECONNREFUSED), /* EREFUSED */ > E(ECONNRESET), > + E(EDEADLK), /* EDEADLOCK */ > +#if EDEADLK != EDEADLOCK /* mips, sparc, powerpc */ > E(EDEADLOCK), > +#endif > E(EDESTADDRREQ), > E(EDOM), > E(EDOTDOT), > @@ -166,14 +171,17 @@ static const char *names_0[] = { > E(EUSERS), > E(EXDEV), > E(EXFULL), > - > - E(ECANCELED), /* ECANCELLED */ > - E(EAGAIN), /* EWOULDBLOCK */ > - E(ECONNREFUSED), /* EREFUSED */ > - E(EDEADLK), /* EDEADLOCK */ > }; > #undef E > > +#ifdef EREFUSED /* parisc */ > +static_assert(EREFUSED == ECONNREFUSED); > +#endif > +#ifdef ECANCELLED /* parisc */ > +static_assert(ECANCELLED == ECANCELED); > +#endif > +static_assert(EAGAIN == EWOULDBLOCK); /* everywhere */ > + > #define E(err) [err - 512 + BUILD_BUG_ON_ZERO(err < 512 || err > 550)] = "-" #err > static const char *names_512[] = { > E(ERESTARTSYS), > -- > 2.29.2 > -- With Best Regards, Andy Shevchenko