[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <202510231714.dlrsh9El-lkp@intel.com>
Date: Thu, 23 Oct 2025 17:58:39 +0800
From: kernel test robot <lkp@...el.com>
To: Dan Carpenter <error27@...il.com>,
Bjorn Andersson <andersson@...nel.org>
Cc: oe-kbuild-all@...ts.linux.dev,
Mathieu Poirier <mathieu.poirier@...aro.org>,
Matthias Brugger <matthias.bgg@...il.com>,
AngeloGioacchino Del Regno <angelogioacchino.delregno@...labora.com>,
linux-remoteproc@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-arm-kernel@...ts.infradead.org,
linux-mediatek@...ts.infradead.org, kernel-janitors@...r.kernel.org
Subject: Re: [PATCH] remoteproc: mtk_scp: remove unnecessary checking
Hi Dan,
kernel test robot noticed the following build warnings:
[auto build test WARNING on remoteproc/rproc-next]
[also build test WARNING on next-20251023]
[cannot apply to linus/master v6.18-rc2]
[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/Dan-Carpenter/remoteproc-mtk_scp-remove-unnecessary-checking/20251022-200619
base: https://git.kernel.org/pub/scm/linux/kernel/git/remoteproc/linux.git rproc-next
patch link: https://lore.kernel.org/r/aPi6eBlFLH43A4C0%40stanley.mountain
patch subject: [PATCH] remoteproc: mtk_scp: remove unnecessary checking
config: arm-randconfig-003-20251023 (https://download.01.org/0day-ci/archive/20251023/202510231714.dlrsh9El-lkp@intel.com/config)
compiler: arm-linux-gnueabi-gcc (GCC) 8.5.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20251023/202510231714.dlrsh9El-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@...el.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202510231714.dlrsh9El-lkp@intel.com/
All warnings (new ones prefixed by >>):
drivers/remoteproc/mtk_scp.c: In function 'scp_rproc_init':
>> drivers/remoteproc/mtk_scp.c:1130:56: warning: '%1d' directive output may be truncated writing between 1 and 10 bytes into a region of size 2 [-Wformat-truncation=]
snprintf(scp_fw_file, ARRAY_SIZE(scp_fw_file), "scp_c%1d", core_id);
^~~
drivers/remoteproc/mtk_scp.c:1130:50: note: directive argument in the range [0, 1073741824]
snprintf(scp_fw_file, ARRAY_SIZE(scp_fw_file), "scp_c%1d", core_id);
^~~~~~~~~~
drivers/remoteproc/mtk_scp.c:1130:3: note: 'snprintf' output between 7 and 16 bytes into a destination of size 7
snprintf(scp_fw_file, ARRAY_SIZE(scp_fw_file), "scp_c%1d", core_id);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
vim +1130 drivers/remoteproc/mtk_scp.c
1096
1097 /**
1098 * scp_get_default_fw_path() - Get default SCP firmware path
1099 * @dev: SCP Device
1100 * @core_id: SCP Core number
1101 *
1102 * This function generates a path based on the following format:
1103 * mediatek/(soc_model)/scp(_cX).img; for multi-core or
1104 * mediatek/(soc_model)/scp.img for single core SCP HW
1105 *
1106 * Return: A devm allocated string containing the full path to
1107 * a SCP firmware or an error pointer
1108 */
1109 static const char *scp_get_default_fw_path(struct device *dev, int core_id)
1110 {
1111 struct device_node *np = core_id < 0 ? dev->of_node : dev->parent->of_node;
1112 const char *compatible, *soc;
1113 char scp_fw_file[7];
1114 int ret;
1115
1116 /* Use only the first compatible string */
1117 ret = of_property_read_string_index(np, "compatible", 0, &compatible);
1118 if (ret)
1119 return ERR_PTR(ret);
1120
1121 /* If the compatible string's length is implausible bail out early */
1122 if (strlen(compatible) < strlen("mediatek,mtXXXX-scp"))
1123 return ERR_PTR(-EINVAL);
1124
1125 /* If the compatible string starts with "mediatek,mt" assume that it's ok */
1126 if (!str_has_prefix(compatible, "mediatek,mt"))
1127 return ERR_PTR(-EINVAL);
1128
1129 if (core_id >= 0)
> 1130 snprintf(scp_fw_file, ARRAY_SIZE(scp_fw_file), "scp_c%1d", core_id);
1131 else
1132 snprintf(scp_fw_file, ARRAY_SIZE(scp_fw_file), "scp");
1133
1134 /* Not using strchr here, as strlen of a const gets optimized by compiler */
1135 soc = &compatible[strlen("mediatek,")];
1136
1137 return devm_kasprintf(dev, GFP_KERNEL, "mediatek/%.*s/%s.img",
1138 (int)strlen("mtXXXX"), soc, scp_fw_file);
1139 }
1140
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
Powered by blists - more mailing lists