Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp7479008rwi; Mon, 24 Oct 2022 15:29:50 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5tnDVyRRuEh1789aRu2UUZwE3UhgZcg59vpzubmiIOOXXl/CF+e1/p4E+WabIbOVey8NDS X-Received: by 2002:a17:907:6d92:b0:78d:d2e5:7cda with SMTP id sb18-20020a1709076d9200b0078dd2e57cdamr29427431ejc.625.1666650590147; Mon, 24 Oct 2022 15:29:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666650590; cv=none; d=google.com; s=arc-20160816; b=doX8Kj1bnRTHBw9ONulOY01Qyjm5iSt8v6kX9NtJqrTbIGBkilC2WpoY5f7mvxDy+j lY7AXHwccUDYIwoFqS2S6HmQzIN0X6bcUtlUvs0mvZkgx40XDW7NtbzUubTSFgz3YU9O b2q5cGFU1eKFSj1ObvLlFWKrPY0SZN7qArJzXuC0AEcZMCY+Gloyj0Aq07yjDVxl0qxu MUutNOhh1qet9RBgpO/8N6sZzLpgwNPn4EwO+ghaKrhYA2DuE8wB5yBQQ9SD+O+4cyoJ cLucwML3WME1DyuXhrIlrJ8NF5OhiJxiIw5yMtfWPh8kLiTYVd7s2h4q2Qro0i9oP6zl YNRA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language:cc:to :subject:from:user-agent:mime-version:date:message-id:dkim-signature :dkim-signature; bh=oIWrFVCTFI0P8Gt8DB2CKcLBPuXOX6c8HwKwpujStPs=; b=Gl2rHRTKUtqbVfN7FvUgVLpPf99JfkltPPOl+eKu7QdWUCefeAGFXLCOmyQk6qzgRF EA6mdR75q49y3m+TkPO71+ZpBtKLxXe/BeDfJFDKa1kPknvo4pUUxxzI6ZhopCFuKs7H iNzi7TTzkNkmX3ee5oHtwh4oXav8/Zs0E36LmtknAz3MApHGBKoWWgcoZDvfg0d+qGGe Vu/ri8Kei7HXLo1KdNrYn/43tQed483hrtZYZs+WZdmSyuZ5HkLJcPNWffpI0eekRKiP lNcEHbsF56mi/plOsHey7xjUBnmNL/uHDBBYORY8ye4TWFsOmmIiGc5SuDfgh+DoUqRw Gi4g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=usXYqPef; dkim=neutral (no key) header.i=@suse.cz; 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 c24-20020a170906171800b007a3b6bccbebsi713686eje.503.2022.10.24.15.29.25; Mon, 24 Oct 2022 15:29:50 -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=@suse.cz header.s=susede2_rsa header.b=usXYqPef; dkim=neutral (no key) header.i=@suse.cz; 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 S235266AbiJXU44 (ORCPT + 99 others); Mon, 24 Oct 2022 16:56:56 -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: 8bit X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,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-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 = 1000000, ... WEIGHT_ONE = 1 << 16, ... VTIME_PER_SEC_SHIFT = 37, VTIME_PER_SEC = 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 ‘ioc_weight_prfill’: block/blk-iocost.c:3035:37: error: format ‘%u’ expects argument of type ‘unsigned int’, but argument 4 has type ‘long unsigned int’ [-Werror=format=] 3035 | seq_printf(sf, "%s %u\n", dname, iocg->cfg_weight / WEIGHT_ONE); | ~^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | | | | unsigned int long unsigned int | %lu block/blk-iocost.c: In function ‘ioc_weight_show’: block/blk-iocost.c:3045:34: error: format ‘%u’ expects argument of type ‘unsigned int’, but argument 3 has type ‘long unsigned int’ [-Werror=format=] 3045 | seq_printf(sf, "default %u\n", iocc->dfl_weight / WEIGHT_ONE); | ~^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | | | | unsigned int long unsigned 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, struct blkg_policy_data *pd, struct ioc_gq *iocg = pd_to_iocg(pd); 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; } @@ -3042,7 +3042,7 @@ static int ioc_weight_show(struct seq_file *sf, void *v) struct blkcg *blkcg = css_to_blkcg(seq_css(sf)); struct ioc_cgrp *iocc = blkcg_to_iocc(blkcg); - 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; -- 2.38.0