linux-block.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Elijah Conners <business@elijahpepe.com>
To: "axboe" <axboe@kernel.dk>
Cc: "tj" <tj@kernel.org>, "newella" <newella@fb.com>,
	"linux-block" <linux-block@vger.kernel.org>,
	"linux-kernel" <linux-kernel@vger.kernel.org>,
	"cgroups" <cgroups@vger.kernel.org>
Subject: [PATCH] blk-iocost: explicitly declare long in seq_printf
Date: Sun, 25 Sep 2022 13:43:36 -0700	[thread overview]
Message-ID: <18376641f12.db248b2f186661.4401757561282192350@elijahpepe.com> (raw)
In-Reply-To: 

On lines 3038 and 3048, seq_printf() is used with iocg->cfg_weight /
WEIGHT_ONE. This operation is a long, not an unsigned int, so the usage
of %u in this printf() function is unusual. While C will automatically
promote iocg->cfg_weight / WEIGHT_ONE to an unsigned int—and safely—it
is ultimately better to tell seq_printf() that this is a long.

Signed-off-by: Elijah Conners <business@elijahpepe.com>
---
 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 7936e5f5821c..78aae116793e 100644
--- a/block/blk-iocost.c
+++ b/block/blk-iocost.c
@@ -3035,7 +3035,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 %ld\n", dname, iocg->cfg_weight / WEIGHT_ONE);
 	return 0;
 }
 
@@ -3045,7 +3045,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 %ld\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.29.2.windows.2

                 reply	other threads:[~2022-09-25 20:43 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=18376641f12.db248b2f186661.4401757561282192350@elijahpepe.com \
    --to=business@elijahpepe.com \
    --cc=axboe@kernel.dk \
    --cc=cgroups@vger.kernel.org \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=newella@fb.com \
    --cc=tj@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).