From nobody Wed Apr 8 08:01:52 2026 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 A315AC38A2D for ; Mon, 24 Oct 2022 20:56:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233306AbiJXU45 (ORCPT ); Mon, 24 Oct 2022 16:56:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58708 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235141AbiJXU4Y (ORCPT ); Mon, 24 Oct 2022 16:56:24 -0400 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 83F7FB3B0A; Mon, 24 Oct 2022 12:03:01 -0700 (PDT) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 1217921E70; Mon, 24 Oct 2022 19:01:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1666638117; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=oIWrFVCTFI0P8Gt8DB2CKcLBPuXOX6c8HwKwpujStPs=; b=usXYqPefh4eEIKMYACSLS5A/8NdFsaITAJCgUzvwEPid3GH+TQTOI23v3ll5y+QNooeUZr 3ze7SirTSyiludyKt5GZz6rSOZ4tTwb4/lM5MDT4xrVqbSLeSQ4fcXWMk6rLmlp1uQzghA S91SJQQGa1p2ZsLepX1DcrVHc9wRUhs= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1666638117; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=oIWrFVCTFI0P8Gt8DB2CKcLBPuXOX6c8HwKwpujStPs=; b=autQ68W9Wcb4TmHypUYFSXRRxqC0YVTZoahysFvUonU38+sDLf5TP/WJB83BWUqQQktFKV qo006gi3pzYwxRCQ== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id E11FC13A79; Mon, 24 Oct 2022 19:01:56 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id juQiNSThVmMpLwAAMHmgww (envelope-from ); Mon, 24 Oct 2022 19:01:56 +0000 Message-ID: Date: Mon, 24 Oct 2022 21:01:56 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.4.0 From: =?UTF-8?Q?Martin_Li=c5=a1ka?= Subject: [PATCH] block: fix Werror=format with GCC 13 To: linux-kernel@vger.kernel.org Cc: linux-block@vger.kernel.org, axboe@kernel.dk Content-Language: en-US Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Starting with GCC 13, since [g3b3083a598ca3f4b] c: C2x enums wider than int [PR36113] GCC promotes enum values with larger than integer types to a wider type. In case of the anonymous enum type in blk-iocost.c it is: enum { MILLION =3D 1000000, ... WEIGHT_ONE =3D 1 << 16, ... VTIME_PER_SEC_SHIFT =3D 37, VTIME_PER_SEC =3D 1LLU << VTIME_PER_SEC_SHIFT, ... as seen VTIME_PER_SEC cannot fit into 32-bits (int type), thus one needs to use 'long unsigned int' in the format string. It fixes then the following 2 warnings: block/blk-iocost.c: In function =E2=80=98ioc_weight_prfill=E2=80=99: block/blk-iocost.c:3035:37: error: format =E2=80=98%u=E2=80=99 expects argu= ment of type =E2=80=98unsigned int=E2=80=99, but argument 4 has type =E2=80= =98long unsigned int=E2=80=99 [-Werror=3Dformat=3D] 3035 | seq_printf(sf, "%s %u\n", dname, iocg->cfg_weight /= WEIGHT_ONE); | ~^ ~~~~~~~~~~~~~~~~~~= ~~~~~~~~~~~ | | | | unsigned int l= ong unsigned int | %lu block/blk-iocost.c: In function =E2=80=98ioc_weight_show=E2=80=99: block/blk-iocost.c:3045:34: error: format =E2=80=98%u=E2=80=99 expects argu= ment of type =E2=80=98unsigned int=E2=80=99, but argument 3 has type =E2=80= =98long unsigned int=E2=80=99 [-Werror=3Dformat=3D] 3045 | seq_printf(sf, "default %u\n", iocc->dfl_weight / WEIGHT_ON= E); | ~^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | | | | unsigned int long unsign= ed int | %lu Signed-off-by: Martin Liska --- block/blk-iocost.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/block/blk-iocost.c b/block/blk-iocost.c index 495396425bad..f165bac9bffb 100644 --- a/block/blk-iocost.c +++ b/block/blk-iocost.c @@ -3032,7 +3032,7 @@ static u64 ioc_weight_prfill(struct seq_file *sf, str= uct blkg_policy_data *pd, struct ioc_gq *iocg =3D pd_to_iocg(pd); =20 if (dname && iocg->cfg_weight) - seq_printf(sf, "%s %u\n", dname, iocg->cfg_weight / WEIGHT_ONE); + seq_printf(sf, "%s %lu\n", dname, iocg->cfg_weight / WEIGHT_ONE); return 0; } =20 @@ -3042,7 +3042,7 @@ static int ioc_weight_show(struct seq_file *sf, void = *v) struct blkcg *blkcg =3D css_to_blkcg(seq_css(sf)); struct ioc_cgrp *iocc =3D blkcg_to_iocc(blkcg); =20 - seq_printf(sf, "default %u\n", iocc->dfl_weight / WEIGHT_ONE); + seq_printf(sf, "default %lu\n", iocc->dfl_weight / WEIGHT_ONE); blkcg_print_blkgs(sf, blkcg, ioc_weight_prfill, &blkcg_policy_iocost, seq_cft(sf)->private, false); return 0; --=20 2.38.0