[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <202507261837.ofrYjyeT-lkp@intel.com>
Date: Sat, 26 Jul 2025 18:36:56 +0800
From: kernel test robot <lkp@...el.com>
To: Ivan Vecera <ivecera@...hat.com>, netdev@...r.kernel.org
Cc: oe-kbuild-all@...ts.linux.dev, Jiri Pirko <jiri@...nulli.us>,
Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>,
Simon Horman <horms@...nel.org>, Jonathan Corbet <corbet@....net>,
Prathosh Satish <Prathosh.Satish@...rochip.com>,
linux-doc@...r.kernel.org, linux-kernel@...r.kernel.org,
Michal Schmidt <mschmidt@...hat.com>, Petr Oros <poros@...hat.com>
Subject: Re: [PATCH net-next 2/5] dpll: zl3073x: Add low-level flash functions
Hi Ivan,
kernel test robot noticed the following build warnings:
[auto build test WARNING on net-next/main]
url: https://github.com/intel-lab-lkp/linux/commits/Ivan-Vecera/dpll-zl3073x-Add-functions-to-access-hardware-registers/20250725-234600
base: net-next/main
patch link: https://lore.kernel.org/r/20250725154136.1008132-3-ivecera%40redhat.com
patch subject: [PATCH net-next 2/5] dpll: zl3073x: Add low-level flash functions
config: x86_64-buildonly-randconfig-003-20250726 (https://download.01.org/0day-ci/archive/20250726/202507261837.ofrYjyeT-lkp@intel.com/config)
compiler: gcc-12 (Debian 12.2.0-14+deb12u1) 12.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250726/202507261837.ofrYjyeT-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/202507261837.ofrYjyeT-lkp@intel.com/
All warnings (new ones prefixed by >>):
drivers/dpll/zl3073x/flash.c: In function 'zl3073x_flash_sectors':
>> drivers/dpll/zl3073x/flash.c:294:70: warning: '%zu' directive output may be truncated writing between 1 and 15 bytes into a region of size 11 [-Wformat-truncation=]
294 | snprintf(comp_str, sizeof(comp_str), "%s-part%zu",
| ^~~
drivers/dpll/zl3073x/flash.c:294:62: note: directive argument in the range [1, 281474976710656]
294 | snprintf(comp_str, sizeof(comp_str), "%s-part%zu",
| ^~~~~~~~~~~~
drivers/dpll/zl3073x/flash.c:294:25: note: 'snprintf' output 7 or more bytes (assuming 21) into a destination of size 16
294 | snprintf(comp_str, sizeof(comp_str), "%s-part%zu",
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
295 | component, (ptr - data) / max_block_size + 1);
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
vim +294 drivers/dpll/zl3073x/flash.c
245
246 /**
247 * zl3073x_flash_sectors - Flash sectors
248 * @zldev: zl3073x device structure
249 * @component: component name
250 * @page: destination flash page
251 * @addr: device memory address to load data
252 * @data: pointer to data to be flashed
253 * @size: size of data
254 * @extack: netlink extack pointer to report errors
255 *
256 * The function flashes given @data with size of @size to the internal flash
257 * memory block starting from page @page. The function uses sector flash
258 * method and has to take into account the flash sector size reported by
259 * flashing utility. Input data are spliced into blocks according this
260 * sector size and each block is flashed separately.
261 *
262 * Return: 0 on success, <0 on error
263 */
264 int zl3073x_flash_sectors(struct zl3073x_dev *zldev, const char *component,
265 u32 page, u32 addr, const void *data, size_t size,
266 struct netlink_ext_ack *extack)
267 {
268 #define ZL_FLASH_MAX_BLOCK_SIZE 0x0001E000
269 #define ZL_FLASH_PAGE_SIZE 256
270 size_t max_block_size, block_size, sector_size;
271 const void *ptr, *end;
272 int rc;
273
274 /* Get flash sector size */
275 rc = zl3073x_flash_get_sector_size(zldev, §or_size);
276 if (rc) {
277 ZL_FLASH_ERR_MSG(zldev, extack,
278 "Failed to get flash sector size");
279 return rc;
280 }
281
282 /* Determine max block size depending on sector size */
283 max_block_size = ALIGN_DOWN(ZL_FLASH_MAX_BLOCK_SIZE, sector_size);
284
285 for (ptr = data, end = data + size; ptr < end; ptr += block_size) {
286 char comp_str[16];
287
288 block_size = min_t(size_t, max_block_size, end - ptr);
289
290 /* Add suffix '-partN' if the requested component size is
291 * greater than max_block_size.
292 */
293 if (max_block_size < size)
> 294 snprintf(comp_str, sizeof(comp_str), "%s-part%zu",
295 component, (ptr - data) / max_block_size + 1);
296 else
297 strscpy(comp_str, component);
298
299 /* Download block to device memory */
300 rc = zl3073x_flash_download(zldev, comp_str, addr, ptr,
301 block_size, extack);
302 if (rc)
303 goto finish;
304
305 /* Set address to flash from */
306 rc = zl3073x_write_u32(zldev, ZL_REG_IMAGE_START_ADDR, addr);
307 if (rc)
308 goto finish;
309
310 /* Set size of block to flash */
311 rc = zl3073x_write_u32(zldev, ZL_REG_IMAGE_SIZE, block_size);
312 if (rc)
313 goto finish;
314
315 /* Set destination page to flash */
316 rc = zl3073x_write_u32(zldev, ZL_REG_FLASH_INDEX_WRITE, page);
317 if (rc)
318 goto finish;
319
320 /* Set filling pattern */
321 rc = zl3073x_write_u32(zldev, ZL_REG_FILL_PATTERN, U32_MAX);
322 if (rc)
323 goto finish;
324
325 zl3073x_devlink_flash_notify(zldev, "Flashing image", comp_str,
326 0, 0);
327
328 dev_dbg(zldev->dev, "Flashing %zu bytes to page %u\n",
329 block_size, page);
330
331 /* Execute sectors flash operation */
332 rc = zl3073x_flash_cmd_wait(zldev, ZL_WRITE_FLASH_OP_SECTORS,
333 extack);
334 if (rc)
335 goto finish;
336
337 /* Move to next page */
338 page += block_size / ZL_FLASH_PAGE_SIZE;
339 }
340
341 finish:
342 zl3073x_devlink_flash_notify(zldev,
343 rc ? "Flashing failed" : "Flashing done",
344 component, 0, 0);
345
346 return rc;
347 }
348
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
Powered by blists - more mailing lists