Received: by 2002:ac0:e34a:0:0:0:0:0 with SMTP id g10csp192513imn; Wed, 27 Jul 2022 03:48:37 -0700 (PDT) X-Google-Smtp-Source: AGRyM1selnlCf31KEmCeZfE6S85OQowRa6Fytni1oGNe5j/4d4IZbHfGxsn2m0eslrPVqq08k92W X-Received: by 2002:a17:907:168c:b0:72f:2b36:5f03 with SMTP id hc12-20020a170907168c00b0072f2b365f03mr17812734ejc.750.1658918917256; Wed, 27 Jul 2022 03:48:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658918917; cv=none; d=google.com; s=arc-20160816; b=eJ81OZWWoZZi5jHMj847Hpj4qDLfOuUUYhePsO56ZDW7yyKb4SHDY72n8gIy9uODXv Q8Hpk10weY06+p3MftTyFMIFPQf2LVGl7k+yz55EjsVOl1NIbbiVxoIcwrjuowCPSAUQ e9Atvx1NsYkjqedKRyol+gr5TMXDZg2MawQ12DF/eYcq4zxrmot576YDQeH7mMS5d3CL Ub7MTp9BWJkNBjWEmAilmFiwRAkU5qws7jFXntS045xmnO4b6o6XV3IqYdwNOzOgmuaw YH03uX3/SjqxoSc5E/69hjvZrv08tr+ZiI+yf8dInJYjRm2xcfZsfeqH7HIuTtbCgnXC xztw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:date:message-id:user-agent:cc:to:references :in-reply-to:from:subject:content-transfer-encoding:mime-version :dkim-signature; bh=IdvNtNHwqWo5cZFa0lrDw3PTiGXEueeMYK44o0VbbLk=; b=x1JWHE52/hOUUzi5lzG6pUE3ZoIqYhOJhHe5oqbb7JfFawkCez/KccXGQmTy/4z8/4 u1hCtnl7fxfDTS9ug27PbKSQbxthLYHtHXItqdz0ouXXFE5mhZqh3yHp7/KW/2GF+RPG UCZUcY+sO/WPFQRPjGbSW6a/8mFDKdRJHiVTu6PfVj4eTFoy0SgrCvFcJGQyflNFRPeN bz4oV/b1WDvT912UzFi74EFubEflKzpLRn7G+qpQ3jndtmVBK57dLDuwhUT02Yq4eDOE sJm/s/WppWTVYmUBRHfGIsiRlp574YQJKmPY9GfKPT1DK5oRcve4CsQgX64KqXOOXqIx XqhA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=URFnToo5; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z4-20020a05640240c400b0043be359d5c5si11239270edb.105.2022.07.27.03.48.19; Wed, 27 Jul 2022 03:48:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless-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=@kernel.org header.s=k20201202 header.b=URFnToo5; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231438AbiG0KsO (ORCPT + 65 others); Wed, 27 Jul 2022 06:48:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47330 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229475AbiG0KsN (ORCPT ); Wed, 27 Jul 2022 06:48:13 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7B47BC03; Wed, 27 Jul 2022 03:48:12 -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 dfw.source.kernel.org (Postfix) with ESMTPS id E578E618A3; Wed, 27 Jul 2022 10:48:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9EE9CC433C1; Wed, 27 Jul 2022 10:48:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1658918891; bh=DRFuPn9kMjyTP06/jiDcxlM9zqpGD3R4D5kU/hYwyLk=; h=Subject:From:In-Reply-To:References:To:Cc:Date:From; b=URFnToo5JzEHl2i3XwSCTggjAVHJj6UFMfKWYLZhpwnkbP2iHgEjljWjwqVWO7KHE FTxehimMJgfU3WB68HHKbspKpXoIrrPebG/H6vZh/HG7HDNLm3NBJtrl+oKwmepNh8 0LeSVct3uBjdBvyloWoMWuHfWBGr+MUXbevB8mL/C+81ZAJ0w0tuQaD45lg7rX1Ud0 UHG0Ao0OYe4bdAYFYqYInFfGs355tPAhhL6uEbr0gWvL63ZeRGpITgTpdomF3yJRMu 22B50ciqsOEKsCH1prDTWH+121e6voq2zs8auIoksskDEvtvZgI9SB2Qw9Hd5baDTN R5RD4zk+EsH1A== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: Re: wifi: iwlwifi: mvm: fix clang -Wformat warnings From: Kalle Valo In-Reply-To: <20220711222919.2043613-1-justinstitt@google.com> References: <20220711222919.2043613-1-justinstitt@google.com> To: Justin Stitt Cc: Gregory Greenman , "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Nathan Chancellor , Nick Desaulniers , Tom Rix , Luca Coelho , Johannes Berg , Avraham Stern , Justin Stitt , Miri Korenblit , linux-wireless@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, llvm@lists.linux.dev User-Agent: pwcli/0.1.1-git (https://github.com/kvalo/pwcli/) Python/3.7.3 Message-ID: <165891888198.17998.12309173336559232552.kvalo@kernel.org> Date: Wed, 27 Jul 2022 10:48:07 +0000 (UTC) X-Spam-Status: No, score=-7.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS 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-wireless@vger.kernel.org Justin Stitt wrote: > When building with Clang we encounter these warnings: > | drivers/net/wireless/intel/iwlwifi/mvm/ftm-initiator.c:1108:47: error: > | format specifies type 'unsigned char' but the argument has type 's16' > | (aka 'short') [-Werror,-Wformat] IWL_DEBUG_INFO(mvm, "\tburst index: > | %hhu\n", res->ftm.burst_index); > - > | drivers/net/wireless/intel/iwlwifi/mvm/ftm-initiator.c:1111:47: error: > | format specifies type 'unsigned char' but the argument has type 's32' > | (aka 'int') [-Werror,-Wformat] IWL_DEBUG_INFO(mvm, "\trssi spread: > | %hhu\n", res->ftm.rssi_spread); > > The previous format specifier `%hhu` describes a u8 but our arguments > are wider than this which means bits are potentially being lost. > > 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 > `%hhu` to `%d` for both instances of the warning. > > Link: https://github.com/ClangBuiltLinux/linux/issues/378 > Signed-off-by: Justin Stitt > Reviewed-by: Nick Desaulniers Patch applied to wireless-next.git, thanks. 7819b3d1dab5 wifi: iwlwifi: mvm: fix clang -Wformat warnings -- https://patchwork.kernel.org/project/linux-wireless/patch/20220711222919.2043613-1-justinstitt@google.com/ https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches