From: kernel test robot <lkp@intel.com>
To: Bramuel Barack <bramwelbarack89@gmail.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Jiri Slaby <jirislaby@kernel.org>,
Krzysztof Kozlowski <krzk@kernel.org>,
Peter Griffin <peter.griffin@linaro.org>
Cc: oe-kbuild-all@lists.linux.dev,
Alim Akhtar <alim.akhtar@samsung.com>,
linux-serial@vger.kernel.org, linux-samsung-soc@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org,
Bramuel Barack <bramwelbarack89@gmail.com>
Subject: Re: [PATCH] tty: serial: samsung_tty: fix -Wformat-overflow warnings for clk_name
Date: Sun, 22 Nov 2026 12:37:08 +0800 [thread overview]
Message-ID: <202611221200.BFeU1ULS-lkp@intel.com> (raw)
In-Reply-To: <20261121192158.44872-1-bramwelbarack89@gmail.com>
Hi Bramuel,
kernel test robot noticed the following build warnings:
[auto build test WARNING on krzk/for-next]
[also build test WARNING on tty/tty-testing tty/tty-next tty/tty-linus usb/usb-testing usb/usb-next usb/usb-linus linus/master v7.4-rc3 next-20261120]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Bramuel-Barack/tty-serial-samsung_tty-fix-Wformat-overflow-warnings-for-clk_name/20261121-222158
base: https://git.kernel.org/pub/scm/linux/kernel/git/krzk/linux.git for-next
patch link: https://lore.kernel.org/r/20261121192158.44872-1-bramwelbarack89%40gmail.com
patch subject: [PATCH] tty: serial: samsung_tty: fix -Wformat-overflow warnings for clk_name
config: parisc-randconfig-1000-20261122 (https://download.01.org/0day-ci/archive/20261122/202611221200.BFeU1ULS-lkp@intel.com/config)
compiler: hppa-linux-gcc (GCC) 8.5.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20261122/202611221200.BFeU1ULS-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/202611221200.BFeU1ULS-lkp@intel.com/
All warnings (new ones prefixed by >>):
drivers/tty/serial/samsung_tty.c: In function 's3c24xx_serial_set_termios':
>> drivers/tty/serial/samsung_tty.c:1389:52: warning: '%u' directive output may be truncated writing between 1 and 10 bytes into a region of size 4 [-Wformat-truncation=]
snprintf(clkname, sizeof(clkname), "clk_uart_baud%u", cnt);
^~
drivers/tty/serial/samsung_tty.c:1389:38: note: directive argument in the range [0, 2147483647]
snprintf(clkname, sizeof(clkname), "clk_uart_baud%u", cnt);
^~~~~~~~~~~~~~~~~
drivers/tty/serial/samsung_tty.c:1389:3: note: 'snprintf' output between 15 and 24 bytes into a destination of size 17
snprintf(clkname, sizeof(clkname), "clk_uart_baud%u", cnt);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/tty/serial/samsung_tty.c: In function 's3c24xx_serial_probe':
drivers/tty/serial/samsung_tty.c:1781:54: warning: '%u' directive output may be truncated writing between 1 and 10 bytes into a region of size 4 [-Wformat-truncation=]
snprintf(clk_name, sizeof(clk_name), "clk_uart_baud%u", clk_num);
^~
drivers/tty/serial/samsung_tty.c:1781:40: note: directive argument in the range [0, 2147483647]
snprintf(clk_name, sizeof(clk_name), "clk_uart_baud%u", clk_num);
^~~~~~~~~~~~~~~~~
drivers/tty/serial/samsung_tty.c:1781:3: note: 'snprintf' output between 15 and 24 bytes into a destination of size 17
snprintf(clk_name, sizeof(clk_name), "clk_uart_baud%u", clk_num);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
vim +1389 drivers/tty/serial/samsung_tty.c
1370
1371 static unsigned int s3c24xx_serial_getclk(struct s3c24xx_uart_port *ourport,
1372 unsigned int req_baud, struct clk **best_clk,
1373 u8 *clk_num)
1374 {
1375 const struct s3c24xx_uart_info *info = ourport->info;
1376 struct clk *clk;
1377 unsigned long rate;
1378 unsigned int baud, quot, best_quot = 0;
1379 char clkname[MAX_CLK_NAME_LENGTH];
1380 int calc_deviation, deviation = (1 << 30) - 1;
1381 u8 cnt;
1382
1383 for (cnt = 0; cnt < info->num_clks; cnt++) {
1384 /* Keep selected clock if provided */
1385 if (ourport->cfg->clk_sel &&
1386 !(ourport->cfg->clk_sel & (1 << cnt)))
1387 continue;
1388
> 1389 snprintf(clkname, sizeof(clkname), "clk_uart_baud%u", cnt);
1390 clk = clk_get(ourport->port.dev, clkname);
1391 if (IS_ERR(clk))
1392 continue;
1393
1394 rate = clk_get_rate(clk);
1395 if (!rate) {
1396 dev_err(ourport->port.dev,
1397 "Failed to get clock rate for %s.\n", clkname);
1398 clk_put(clk);
1399 continue;
1400 }
1401
1402 if (ourport->info->has_divslot) {
1403 unsigned long div = rate / req_baud;
1404
1405 /* The UDIVSLOT register on the newer UARTs allows us to
1406 * get a divisor adjustment of 1/16th on the baud clock.
1407 *
1408 * We don't keep the UDIVSLOT value (the 16ths we
1409 * calculated by not multiplying the baud by 16) as it
1410 * is easy enough to recalculate.
1411 */
1412
1413 quot = div / 16;
1414 baud = rate / div;
1415 } else {
1416 quot = (rate + (8 * req_baud)) / (16 * req_baud);
1417 baud = rate / (quot * 16);
1418 }
1419 quot--;
1420
1421 calc_deviation = abs(req_baud - baud);
1422
1423 if (calc_deviation < deviation) {
1424 /*
1425 * If we find a better clk, release the previous one, if
1426 * any.
1427 */
1428 if (!IS_ERR(*best_clk))
1429 clk_put(*best_clk);
1430 *best_clk = clk;
1431 best_quot = quot;
1432 *clk_num = cnt;
1433 deviation = calc_deviation;
1434 } else {
1435 clk_put(clk);
1436 }
1437 }
1438
1439 return best_quot;
1440 }
1441
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
prev parent reply other threads:[~2026-11-22 4:37 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-21 19:21 Bramuel Barack
2026-11-22 4:37 ` kernel test robot [this message]
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=202611221200.BFeU1ULS-lkp@intel.com \
--to=lkp@intel.com \
--cc=alim.akhtar@samsung.com \
--cc=bramwelbarack89@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=jirislaby@kernel.org \
--cc=krzk@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-samsung-soc@vger.kernel.org \
--cc=linux-serial@vger.kernel.org \
--cc=oe-kbuild-all@lists.linux.dev \
--cc=peter.griffin@linaro.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
all inboxes | Powered by JetHome®