Hi Jani,
kernel test robot noticed the following build warnings:
[auto build test WARNING on drm-misc/drm-misc-next]
[also build test WARNING on drm-intel/for-linux-next
drm-intel/for-linux-next-fixes drm-tip/drm-tip linus/master v6.7 next-20240112]
[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/Jani-Nikula/drm-nouveau-acr-ga102-remove-unused-but-set-variable/20240111-014206
base: git://anongit.freedesktop.org/drm/drm-misc drm-misc-next
patch link:
https://lore.kernel.org/r/14c0108a54007a8360d84162a1d63cba9613b945.1704908087.git.jani.nikula%40intel.com
patch subject: [PATCH 4/6] drm/imx: prefer snprintf over sprintf
config: sparc64-allmodconfig
(https://download.01.org/0day-ci/archive/20240112/202401121801.3j6gnsgm-...@intel.com/config)
compiler: sparc64-linux-gcc (GCC) 13.2.0
reproduce (this is a W=1 build):
(https://download.01.org/0day-ci/archive/20240112/202401121801.3j6gnsgm-...@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
| Closes:
https://lore.kernel.org/oe-kbuild-all/202401121801.3j6gnsgm-...@intel.com/
All warnings (new ones prefixed by >>):
drivers/gpu/drm/imx/ipuv3/imx-ldb.c: In function 'imx_ldb_probe':
>> drivers/gpu/drm/imx/ipuv3/imx-ldb.c:658:57: warning: '_sel' directive output
>> may be truncated writing 4 bytes into a region of size between 3 and 13
>> [-Wformat-truncation=]
658 | snprintf(clkname, sizeof(clkname), "di%d_sel", i);
| ^~~~
drivers/gpu/drm/imx/ipuv3/imx-ldb.c:658:17: note: 'snprintf' output between
8 and 18 bytes into a destination of size 16
658 | snprintf(clkname, sizeof(clkname), "di%d_sel", i);
| ^
vim +/_sel +658 drivers/gpu/drm/imx/ipuv3/imx-ldb.c
617
618 static int imx_ldb_probe(struct platform_device *pdev)
619 {
620 struct device *dev = >dev;
621 struct device_node *np = dev->of_node;
622 struct device_node *child;
623 struct imx_ldb *imx_ldb;
624 int dual;
625 int ret;
626 int i;
627
628 imx_ldb = devm_kzalloc(dev, sizeof(*imx_ldb), GFP_KERNEL);
629 if (!imx_ldb)
630 return -ENOMEM;
631
632 imx_ldb->regmap = syscon_regmap_lookup_by_phandle(np, "gpr");
633 if (IS_ERR(imx_ldb->regmap)) {
634 dev_err(dev, "failed to get parent regmap\n");
635 return PTR_ERR(imx_ldb->regmap);
636 }
637
638 /* disable LDB by resetting the control register to POR default
*/
639 regmap_write(imx_ldb->regmap, IOMUXC_GPR2, 0);
640
641 imx_ldb->dev = dev;
642 imx_ldb->lvds_mux = device_get_match_data(dev);
643
644 dual = of_property_read_bool(np, "fsl,dual-channel");
645 if (dual)
646 imx_ldb->ldb_ctrl |= LDB_SPLIT_MODE_EN;
647
648 /*
649 * There are three different possible clock mux configurations:
650 * i.MX53: ipu1_di0_sel, ipu1_di1_sel
651 * i.MX6q: ipu1_di0_sel, ipu1_di1_sel, ipu2_di0_sel,
ipu2_di1_sel
652 * i.MX6dl: ipu1_di0_sel, ipu1_di1_sel, lcdif_sel
653 * Map them all to di0_sel...di3_sel.
654 */
655 for (i = 0; i < 4; i++) {
656 char clkname[16];
657
> 658 snprintf(clkname, sizeof(clkname), "di%d_sel", i);
659 imx_ldb->clk_sel[i] = devm_clk_get(imx_ldb->dev,
clkname);
660 if (IS_ERR(imx_ldb->clk_sel[i])) {
661 ret = PTR_ERR(imx_ldb->clk_sel[i]);
662 imx_ldb->clk_sel[i] = NULL;
663 break;
664 }
665
666 imx_ldb->clk_parent[i] =
clk_get_parent(imx_ldb->clk_sel[i]);
667 }
668 if (i == 0)
669 return ret;
670
671 for_each_child_of_node(np, child) {
672 struct imx_ldb_channel *channel;
673 int bus_format;
674
675 ret = of_property_read_u32(child, "reg", );
676 if (ret || i < 0 || i > 1) {
677 ret = -EINVAL;
678 goto free_child