From: kernel test robot <lkp@intel.com>
To: Shaohua Li <shli@fb.com>
Cc: oe-kbuild-all@lists.linux.dev, linux-kernel@vger.kernel.org,
Jens Axboe <axboe@kernel.dk>
Subject: block/blk-throttle.c:1488:74: warning: 'snprintf' output may be truncated before the last format character
Date: Sun, 19 Nov 2023 10:51:31 +0800 [thread overview]
Message-ID: <202311191030.CRFJc6T4-lkp@intel.com> (raw)
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: b8f1fa2419c19c81bc386a6b350879ba54a573e1
commit: ada75b6e5b2a939401d4919dfaf2f2fc9484f68a blk-throttle: add interface to configure idle time threshold
date: 7 years ago
config: x86_64-randconfig-r031-20230816 (https://download.01.org/0day-ci/archive/20231119/202311191030.CRFJc6T4-lkp@intel.com/config)
compiler: gcc-12 (Debian 12.2.0-14) 12.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20231119/202311191030.CRFJc6T4-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202311191030.CRFJc6T4-lkp@intel.com/
All warnings (new ones prefixed by >>):
block/blk-throttle.c:1675:13: warning: 'throtl_tg_is_idle' defined but not used [-Wunused-function]
1675 | static bool throtl_tg_is_idle(struct throtl_grp *tg)
| ^~~~~~~~~~~~~~~~~
block/blk-throttle.c: In function 'tg_prfill_limit':
>> block/blk-throttle.c:1488:74: warning: 'snprintf' output may be truncated before the last format character [-Wformat-truncation=]
1488 | snprintf(idle_time, sizeof(idle_time), " idle=%lu",
| ^
block/blk-throttle.c:1488:25: note: 'snprintf' output between 8 and 27 bytes into a destination of size 26
1488 | snprintf(idle_time, sizeof(idle_time), " idle=%lu",
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1489 | tg->idletime_threshold);
| ~~~~~~~~~~~~~~~~~~~~~~~
vim +/snprintf +1488 block/blk-throttle.c
1442
1443 static u64 tg_prfill_limit(struct seq_file *sf, struct blkg_policy_data *pd,
1444 int off)
1445 {
1446 struct throtl_grp *tg = pd_to_tg(pd);
1447 const char *dname = blkg_dev_name(pd->blkg);
1448 char bufs[4][21] = { "max", "max", "max", "max" };
1449 u64 bps_dft;
1450 unsigned int iops_dft;
1451 char idle_time[26] = "";
1452
1453 if (!dname)
1454 return 0;
1455
1456 if (off == LIMIT_LOW) {
1457 bps_dft = 0;
1458 iops_dft = 0;
1459 } else {
1460 bps_dft = U64_MAX;
1461 iops_dft = UINT_MAX;
1462 }
1463
1464 if (tg->bps_conf[READ][off] == bps_dft &&
1465 tg->bps_conf[WRITE][off] == bps_dft &&
1466 tg->iops_conf[READ][off] == iops_dft &&
1467 tg->iops_conf[WRITE][off] == iops_dft &&
1468 (off != LIMIT_LOW || tg->idletime_threshold ==
1469 tg->td->dft_idletime_threshold))
1470 return 0;
1471
1472 if (tg->bps_conf[READ][off] != bps_dft)
1473 snprintf(bufs[0], sizeof(bufs[0]), "%llu",
1474 tg->bps_conf[READ][off]);
1475 if (tg->bps_conf[WRITE][off] != bps_dft)
1476 snprintf(bufs[1], sizeof(bufs[1]), "%llu",
1477 tg->bps_conf[WRITE][off]);
1478 if (tg->iops_conf[READ][off] != iops_dft)
1479 snprintf(bufs[2], sizeof(bufs[2]), "%u",
1480 tg->iops_conf[READ][off]);
1481 if (tg->iops_conf[WRITE][off] != iops_dft)
1482 snprintf(bufs[3], sizeof(bufs[3]), "%u",
1483 tg->iops_conf[WRITE][off]);
1484 if (off == LIMIT_LOW) {
1485 if (tg->idletime_threshold == ULONG_MAX)
1486 strcpy(idle_time, " idle=max");
1487 else
> 1488 snprintf(idle_time, sizeof(idle_time), " idle=%lu",
1489 tg->idletime_threshold);
1490 }
1491
1492 seq_printf(sf, "%s rbps=%s wbps=%s riops=%s wiops=%s%s\n",
1493 dname, bufs[0], bufs[1], bufs[2], bufs[3], idle_time);
1494 return 0;
1495 }
1496
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
reply other threads:[~2023-11-19 2:57 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=202311191030.CRFJc6T4-lkp@intel.com \
--to=lkp@intel.com \
--cc=axboe@kernel.dk \
--cc=linux-kernel@vger.kernel.org \
--cc=oe-kbuild-all@lists.linux.dev \
--cc=shli@fb.com \
/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
all inboxes | Powered by JetHome®