Skip to contentSkip to conversation

drivers/dma/ep93xx_dma.c:1365:51: warning: '%u' directive writing between 1 and 8 bytes into a region of size 2

PATCH kernel test robot 1 participant 1 message Sep 12, 2024 Memory management

lore
Share & tools
lore

kernel test robot

author build bot
#0 lore raw
tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
head:   57f962b956f1d116cd64d5c406776c4975de549d
commit: 4e8ad5ed845beead6211d2121598fa84e40bca70 [11144/11623] dmaengine: cirrus: Convert to DT for Cirrus EP93xx
config: powerpc-randconfig-r036-20220117 (https://download.01.org/0day-ci/archive/20240912/[email protected]/config)
compiler: powerpc-linux-gcc (GCC) 13.3.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240912/[email protected]/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 <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

All warnings (new ones prefixed by >>):

drivers/dma/ep93xx_dma.c: In function 'ep93xx_dma_of_probe':

>> drivers/dma/ep93xx_dma.c:1365:51: warning: '%u' directive writing between 1 and 8 bytes into a region of size 2 [-Wformat-overflow=]
    1365 |                         sprintf(dma_clk_name, "m2p%u", i);
         |                                                   ^~
   drivers/dma/ep93xx_dma.c:1365:47: note: directive argument in the range [0, 16777216]
    1365 |                         sprintf(dma_clk_name, "m2p%u", i);
         |                                               ^~~~~~~
   drivers/dma/ep93xx_dma.c:1365:25: note: 'sprintf' output between 5 and 12 bytes into a destination of size 5
    1365 |                         sprintf(dma_clk_name, "m2p%u", i);
         |                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/dma/ep93xx_dma.c:1363:51: warning: '%u' directive writing between 1 and 8 bytes into a region of size 2 [-Wformat-overflow=]
    1363 |                         sprintf(dma_clk_name, "m2m%u", i);
         |                                                   ^~
   drivers/dma/ep93xx_dma.c:1363:47: note: directive argument in the range [0, 16777216]
    1363 |                         sprintf(dma_clk_name, "m2m%u", i);
         |                                               ^~~~~~~
   drivers/dma/ep93xx_dma.c:1363:25: note: 'sprintf' output between 5 and 12 bytes into a destination of size 5
    1363 |                         sprintf(dma_clk_name, "m2m%u", i);
         |                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

vim +1365 drivers/dma/ep93xx_dma.c

1324
1325 static struct ep93xx_dma_engine *ep93xx_dma_of_probe(struct platform_device *pdev)
1326 {
1327 const struct ep93xx_edma_data *data;
1328 struct device *dev = &pdev->dev;
1329 struct ep93xx_dma_engine *edma;
1330 struct dma_device *dma_dev;
1331 char dma_clk_name[5];
1332 int i;
1333
1334 data = device_get_match_data(dev);
1335 if (!data)
1336 return ERR_PTR(dev_err_probe(dev, -ENODEV, "No device match found\n"));
1337
1338 edma = devm_kzalloc(dev, struct_size(edma, channels, data->num_channels),
1339 GFP_KERNEL);
1340 if (!edma)
1341 return ERR_PTR(-ENOMEM);
1342
1343 edma->m2m = data->id;
1344 edma->num_channels = data->num_channels;
1345 dma_dev = &edma->dma_dev;
1346
1347 INIT_LIST_HEAD(&dma_dev->channels);
1348 for (i = 0; i < edma->num_channels; i++) {
1349 struct ep93xx_dma_chan *edmac = &edma->channels[i];
1350
1351 edmac->chan.device = dma_dev;
1352 edmac->regs = devm_platform_ioremap_resource(pdev, i);
1353 if (IS_ERR(edmac->regs))
1354 return edmac->regs;
1355
1356 edmac->irq = fwnode_irq_get(dev_fwnode(dev), i);
1357 if (edmac->irq < 0)
1358 return ERR_PTR(edmac->irq);
1359
1360 edmac->edma = edma;
1361
1362 if (edma->m2m)
1363 sprintf(dma_clk_name, "m2m%u", i);
1364 else

> 1365				sprintf(dma_clk_name, "m2p%u", i);

1366
1367 edmac->clk = devm_clk_get(dev, dma_clk_name);
1368 if (IS_ERR(edmac->clk)) {
1369 dev_err_probe(dev, PTR_ERR(edmac->clk),
1370 "no %s clock found\n", dma_clk_name);
1371 return ERR_CAST(edmac->clk);
1372 }
1373
1374 spin_lock_init(&edmac->lock);
1375 INIT_LIST_HEAD(&edmac->active);
1376 INIT_LIST_HEAD(&edmac->queue);
1377 INIT_LIST_HEAD(&edmac->free_list);
1378 tasklet_setup(&edmac->tasklet, ep93xx_dma_tasklet);
1379
1380 list_add_tail(&edmac->chan.device_node,
1381 &dma_dev->channels);
1382 }
1383
1384 return edma;
1385 }
1386

Signature · 2 lines
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki