From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 18379C43334 for ; Thu, 7 Jul 2022 17:58:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235749AbiGGR65 (ORCPT ); Thu, 7 Jul 2022 13:58:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33472 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235807AbiGGR6z (ORCPT ); Thu, 7 Jul 2022 13:58:55 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C127E240AD; Thu, 7 Jul 2022 10:58:50 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id D1336B82299; Thu, 7 Jul 2022 17:58:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D59E9C3411E; Thu, 7 Jul 2022 17:58:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1657216727; bh=iL3xIVjNybuWSiJjZ22VYxa1SB6+T14cOhJZN7GXylI=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=LDQrMLNrzJ6N5uQHsqODYBfAgEIQ1w+ISzrC5bbPvDpbr2SISXO3U+dJkEYXLD9NI XePnOs2Zx7ktshBV61vIp6UjBVtCr4FRvRJEwIDt+yLsC6nOQxgNGBLqp8MBLnCQHC EmNXV/y2HBtC+S64KN8I97tX+RoapjOxA1jU5layGe7ejrTCiXIjsp6bDAZm5IFmrx tkoJKWxC/gfjGH/gGL+uAg/hb5pE488qNrC3VuV8AE+SivhrvRXbYCmCgifSTO/TEX XGONNh3hPdOJM+3i/UJhczZgbt8Xgeuo9EkFSfphoDEXVCNYbg95xUqVA1EIJ1e3JE TfXjIBUtptDOg== Date: Thu, 7 Jul 2022 10:58:45 -0700 From: Nathan Chancellor To: Justin Stitt Cc: "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , David Howells , Marc Dionne , Nick Desaulniers , Tom Rix , linux-afs@lists.infradead.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, llvm@lists.linux.dev Subject: Re: [PATCH] net: rxrpc: fix clang -Wformat warning Message-ID: References: <20220706235648.594609-1-justinstitt@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220706235648.594609-1-justinstitt@google.com> Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Hi Justin, On Wed, Jul 06, 2022 at 04:56:48PM -0700, Justin Stitt wrote: > When building with Clang we encounter this warning: > | net/rxrpc/rxkad.c:434:33: error: format specifies type 'unsigned short' > | but the argument has type 'u32' (aka 'unsigned int') [-Werror,-Wformat] > | _leave(" = %d [set %hx]", ret, y); > > y is a u32 but the format specifier is `%hx`. Going from unsigned int to > short int results in a loss of data. This is surely not intended > behavior. If it is intended, the warning should be suppressed through > other means. > > This patch should get us closer to the goal of enabling the -Wformat > flag for Clang builds. > > Link: https://github.com/ClangBuiltLinux/linux/issues/378 > Signed-off-by: Justin Stitt > --- > net/rxrpc/rxkad.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/net/rxrpc/rxkad.c b/net/rxrpc/rxkad.c > index 08aab5c01437..aa180464ec37 100644 > --- a/net/rxrpc/rxkad.c > +++ b/net/rxrpc/rxkad.c > @@ -431,7 +431,7 @@ static int rxkad_secure_packet(struct rxrpc_call *call, > break; > } > > - _leave(" = %d [set %hx]", ret, y); > + _leave(" = %d [set %u]", ret, y); Should this just become %x to keep printing it as a hexidecimal number? Cheers, Nathan > return ret; > } > > -- > 2.37.0.rc0.161.g10f37bed90-goog >