Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp4050852imw; Thu, 7 Jul 2022 11:52:17 -0700 (PDT) X-Google-Smtp-Source: AGRyM1snT7zmVCjEbczKVAHnXV1FQqgKV9QaNNLoADlKm3HUxpjMo98+9MdtsU/fcUfYX9OoPLjT X-Received: by 2002:a65:6a50:0:b0:3f6:4566:581d with SMTP id o16-20020a656a50000000b003f64566581dmr39501000pgu.122.1657219937195; Thu, 07 Jul 2022 11:52:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657219937; cv=none; d=google.com; s=arc-20160816; b=FblJsaXxbg2vZbGJrxUA9Vzh49RUq5O0UnvxaVZscDqIIZ2rSvKJ5M78BLCnS2sDNj 9oBfxOvd94TadpYLHF7mrgLYPMcRse9pFJmWG8v4+HwD2r/AJSkVAwjFlVR/tAl0etX4 G/XpGGE5bmryD1rv/U3Jij1jDKYDEPO6KZHaVJExPMzu3TckQ/NbmXw3aM/gls5tPQLL HpBEeH6+R1w05RFTqkyCrEqf2+Rvne7mvmxI0mlazxMI3wKq9acFOK3h+vSZGLX/5Ng7 A4zijDBw5o42baC9PWnI7/p+wCai2K9pcrPLx71rTA+/Y5Q8Lkenpacj7AmwPpZrUK3+ zK7w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:from:subject:mime-version:message-id:date :dkim-signature; bh=WyqPYSVnBKbl/nr40y7sE7AfbPIEB8jJthH3qsZRwTA=; b=ulowo5cQvkgS6YAT8JdgPKoytHdyj7+JkoNkQDml3x9k0tQRleiKxKin1HtNYcnhk+ FgTAPbknUtdizOATCcV3xIUsXXQ3B7QwpwrkifZeBvzMB3LcVirR+OaZMqsDkQ+QEqo3 5GVxGAHhGZ8yNYsGEjucwvz0yALk0S9CmmHBxoZ03qBWU7/8iSMQryKRAjTX0hO9Aeq2 lrFXiemKh42+6Y/XAvChHXZyDz/IHb1h1yBNYlPsYgn1Yo7Rw/+bk8mszTbUBO5EMAZZ pTL/TXCY1cospmnaXM3JPK72DpbySF16CIGpTG+nTm5An7QxFKnA9b/HyWGOACYGd3Dz hz6g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=dnqfTJXG; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 20-20020a630a14000000b004126729b68csi14539538pgk.804.2022.07.07.11.52.04; Thu, 07 Jul 2022 11:52:17 -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; dkim=pass header.i=@google.com header.s=20210112 header.b=dnqfTJXG; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235567AbiGGSPs (ORCPT + 99 others); Thu, 7 Jul 2022 14:15:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43262 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235575AbiGGSPq (ORCPT ); Thu, 7 Jul 2022 14:15:46 -0400 Received: from mail-pf1-x44a.google.com (mail-pf1-x44a.google.com [IPv6:2607:f8b0:4864:20::44a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B2B6622BE2 for ; Thu, 7 Jul 2022 11:15:44 -0700 (PDT) Received: by mail-pf1-x44a.google.com with SMTP id 138-20020a621890000000b00527c88db25fso7723038pfy.12 for ; Thu, 07 Jul 2022 11:15:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=date:message-id:mime-version:subject:from:to:cc; bh=WyqPYSVnBKbl/nr40y7sE7AfbPIEB8jJthH3qsZRwTA=; b=dnqfTJXGdi0+0FQWJVIluP9qFR8tn9FFDKE/o7TQ9D9+9nSIvt3ROmw8bwLqp/nk0a bf0FuVwic/qm0DrYAJCc1pFXDdpTPmT0tSbEICTZ+pfYV8DKzRFTdF+141+GjWUjwQRp QzLvsqovmrnEMyfDJ/7HdhFzKkCciuR3Qi1ipw5Cf7TI8Nz9EV4yYk3UBrTQYNHllrja bTeWVLAzCLBiMBiVRXMeEqceXRlQr+0luk8omnYLqhs/NFnKe48+83GAn6wUStYTqssD 8UL1kyN+jlNMOBCpH9Uw7CRSsyrrMlr41sMk6fy8bYqO6OEoVY1b3mo2E3g0pxJf4FgO JoHg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:message-id:mime-version:subject:from:to:cc; bh=WyqPYSVnBKbl/nr40y7sE7AfbPIEB8jJthH3qsZRwTA=; b=uidyiecalRas3QKBE/4vMuhg01/GOzsjlyhHHoI4/2sTe5RNCBhOAB5hEpa7XXna99 lButno22Oa5tX4OZMFAG1yh9dSd77b/vT8oF+4wBLb4fIzQOlkbITxx4PEoXD5VHveWd I6V0y7fTNZ8K+82aYOACnS9hez6XWnkHuVIEiTrRXjcvxIbBknPPG15PjULJ30agYZ7B CvUPjxZD1V8qlmSH+491d3/xniclxA5kXLSfuNoRzKIyRGwWl5XMxM5OjMMShYj9oqMQ 5KCAs4AGfaoq7nPyPFmb0G65buqUwX5bcDhAZFmyibfzfxbJtbB0E7TGs+ksY+yO/7aH j8xw== X-Gm-Message-State: AJIora9sfBPAdo8BMzy2xjzjTuoDbQG1GJJPM84QGU7xvxcQkCQgGDMs t8a6oRfpnyMEpBoauOUsecpka89B363QC++EmA== X-Received: from justinstitt.mtv.corp.google.com ([2620:15c:211:202:4640:519a:f833:9a5]) (user=justinstitt job=sendgmr) by 2002:aa7:8e86:0:b0:528:c755:1d96 with SMTP id a6-20020aa78e86000000b00528c7551d96mr5326209pfr.30.1657217744245; Thu, 07 Jul 2022 11:15:44 -0700 (PDT) Date: Thu, 7 Jul 2022 11:15:32 -0700 Message-Id: <20220707181532.762452-1-justinstitt@google.com> Mime-Version: 1.0 X-Mailer: git-send-email 2.37.0.rc0.161.g10f37bed90-goog Subject: [PATCH] net: ipv4: esp4: fix clang -Wformat warning From: Justin Stitt To: Steffen Klassert , Herbert Xu , "David S . Miller" , Hideaki YOSHIFUJI , David Ahern , Eric Dumazet , Jakub Kicinski , Paolo Abeni Cc: Nathan Chancellor , Nick Desaulniers , Tom Rix , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, llvm@lists.linux.dev, Justin Stitt Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-9.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,USER_IN_DEF_DKIM_WL 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 When building with Clang we encounter this warning: | 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. Nathan also mentions: This solution is in line with printk-formats.rst after commit cbacb5ab0aa0 ("docs: printk-formats: Stop encouraging use of unnecessary %h[xudi] and %hh[xudi]"). Link: https://github.com/ClangBuiltLinux/linux/issues/378 Suggested-by: Nathan Chancellor Signed-off-by: Justin Stitt --- This is the exact same issue (and fix) as: https://lore.kernel.org/all/20220707173040.704116-1-justinstitt@google.com/ This really should have been a 2-patch series but I've been going through warnings and systematically fixing them whilst submitting patches as I go. net/ipv4/esp4.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/ipv4/esp4.c b/net/ipv4/esp4.c index b21238df3301..de48dcac18eb 100644 --- a/net/ipv4/esp4.c +++ b/net/ipv4/esp4.c @@ -1108,7 +1108,7 @@ static int esp_init_authenc(struct xfrm_state *x) err = -EINVAL; if (aalg_desc->uinfo.auth.icv_fullbits / 8 != crypto_aead_authsize(aead)) { - pr_info("ESP: %s digestsize %u != %hu\n", + pr_info("ESP: %s digestsize %u != %d\n", x->aalg->alg_name, crypto_aead_authsize(aead), aalg_desc->uinfo.auth.icv_fullbits / 8); -- 2.37.0.rc0.161.g10f37bed90-goog