Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp402242imw; Thu, 14 Jul 2022 03:41:55 -0700 (PDT) X-Google-Smtp-Source: AGRyM1tUC6U4QCj9seD7/LPCFXmROxhAPlhagKvVgFaTmImL479g9XhqbYcim+y4zOJZoBGo95xM X-Received: by 2002:a17:907:8a16:b0:72b:9196:f029 with SMTP id sc22-20020a1709078a1600b0072b9196f029mr8186362ejc.359.1657795315309; Thu, 14 Jul 2022 03:41:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657795315; cv=none; d=google.com; s=arc-20160816; b=NPsaegREOwwfNYJ/vod7IAtSNgledMADyX4ohUIWYCDGiIGADBqfZnl/Vm4dXUyJKa mWEQiVb0ySau/yn8eO6Yuiys1rDoAtHGISqFQ++VsFX2yTZg9p9uPrKnVDEDVe2PCyGI smIRZO8n3kTZfV4mIHtpJHDJRhy1OF3PKlCjSsmaFMtFVKBfMJ/g2FprhlPvlHUXesKT XyicDyL2DgKbCM5jTs4q/OMBBP2iGsGulNdHBbqsWwQqBeal72hFfQKRVTC/IwrU73GT +EktSHpacEhmihGpuKUPHf1T/EgybXc+URzuY5YwRZXt8GZoc6tgjRVNIqHCV8jWORd+ bU/Q== 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; bh=huyCBEtYDloIfSW48fumoW5K0nViJActNvGOZxaqIX8=; b=FOSnHMoClAsGW/VR0hH4vcqTiY8lBf+LDmSWRk1B7/nohIrNQ8ecf/STOT3XowNzTH YGxxifyap+vuZg+6UhevBtqVL+Z7fE6IGqZqH26f8zDzjDdd2GNg/lCrUJktZN2DGzo1 GnRnok9D02EW1QmfMXw12INV8ptctpbMSFZIkgtg+c9toD8Uzf0H+5cyLIVDl9vWC5BA zMeQpsn/HnOCa2tSgeB08NF7iyWDYEtlqAviOJtNX6tKjl9OsRPHfr4/K5xjiZ25DvCN FA5yMF3xqTeaoKeAyJExyvGxRmi2bLfMVJizPiz/cs0XmClKTTin+FE0FRlKnqd+HRwI SA1Q== 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:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i18-20020a05640242d200b0043a72951a14si2100597edc.304.2022.07.14.03.41.29; Thu, 14 Jul 2022 03:41:55 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238345AbiGNKc6 (ORCPT + 99 others); Thu, 14 Jul 2022 06:32:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41412 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229981AbiGNKc5 (ORCPT ); Thu, 14 Jul 2022 06:32:57 -0400 Received: from a.mx.secunet.com (a.mx.secunet.com [62.96.220.36]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AD6724AD7C; Thu, 14 Jul 2022 03:32:55 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by a.mx.secunet.com (Postfix) with ESMTP id 5726E20563; Thu, 14 Jul 2022 12:32:51 +0200 (CEST) X-Virus-Scanned: by secunet Received: from a.mx.secunet.com ([127.0.0.1]) by localhost (a.mx.secunet.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id PWPr9kUYYydu; Thu, 14 Jul 2022 12:32:50 +0200 (CEST) Received: from mailout2.secunet.com (mailout2.secunet.com [62.96.220.49]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by a.mx.secunet.com (Postfix) with ESMTPS id 63BA6201CA; Thu, 14 Jul 2022 12:32:50 +0200 (CEST) Received: from cas-essen-01.secunet.de (unknown [10.53.40.201]) by mailout2.secunet.com (Postfix) with ESMTP id 512FF80004A; Thu, 14 Jul 2022 12:32:50 +0200 (CEST) Received: from mbx-dresden-01.secunet.de (10.53.40.199) by cas-essen-01.secunet.de (10.53.40.201) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Thu, 14 Jul 2022 12:32:50 +0200 Received: from gauss2.secunet.de (10.182.7.193) by mbx-dresden-01.secunet.de (10.53.40.199) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Thu, 14 Jul 2022 12:32:49 +0200 Received: by gauss2.secunet.de (Postfix, from userid 1000) id 1451D3180B08; Thu, 14 Jul 2022 12:32:49 +0200 (CEST) Date: Thu, 14 Jul 2022 12:32:49 +0200 From: Steffen Klassert To: Justin Stitt CC: Herbert Xu , "David S . Miller" , Hideaki YOSHIFUJI , "David Ahern" , Eric Dumazet , "Jakub Kicinski" , Paolo Abeni , "Nathan Chancellor" , Nick Desaulniers , Tom Rix , , , , Joe Perches Subject: Re: [PATCH v2] net: ipv4: fix clang -Wformat warnings Message-ID: <20220714103249.GK2950045@gauss3.secunet.de> References: <20220709003704.646568-1-justinstitt@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: <20220709003704.646568-1-justinstitt@google.com> X-ClientProxiedBy: cas-essen-02.secunet.de (10.53.40.202) To mbx-dresden-01.secunet.de (10.53.40.199) X-EXCLAIMER-MD-CONFIG: 2c86f778-e09b-4440-8b15-867914633a10 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham 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 On Fri, Jul 08, 2022 at 05:37:04PM -0700, Justin Stitt wrote: > When building with Clang we encounter these warnings: > | net/ipv4/ah4.c:513:4: error: format specifies type 'unsigned short' but > | the argument has type 'int' [-Werror,-Wformat] > | aalg_desc->uinfo.auth.icv_fullbits / 8); > - > | net/ipv4/esp4.c:1114:5: error: format specifies type 'unsigned short' > | but the argument has type 'int' [-Werror,-Wformat] > | aalg_desc->uinfo.auth.icv_fullbits / 8); > > `aalg_desc->uinfo.auth.icv_fullbits` is a u16 but due to default > argument promotion becomes an int. > > Variadic functions (printf-like) undergo default argument promotion. > Documentation/core-api/printk-formats.rst specifically recommends using > the promoted-to-type's format flag. > > As per C11 6.3.1.1: > (https://www.open-std.org/jtc1/sc22/wg14/www/docs/n1548.pdf) `If an int > can represent all values of the original type ..., the value is > converted to an int; otherwise, it is converted to an unsigned int. > These are called the integer promotions.` Thus it makes sense to change > %hu to %d not only to follow this standard but to suppress the warning > as well. > > Link: https://github.com/ClangBuiltLinux/linux/issues/378 > Signed-off-by: Justin Stitt > Suggested-by: Joe Perches > Suggested-by: Nathan Chancellor > Suggested-by: Nick Desaulniers Applied to the ipsec tree, thanks a lot!