Skip to contentSkip to conversation

dmaengine: cirrus: use snprintf() to calm down gcc 13.3.0

PATCH Applied Alexander Sverdlin 2 participants 2 messages Sep 12, 2024 – Sep 16, 2024 dmaengine

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 dmaengine: cirrus: use snprintf() to calm down gcc 13.3.0

Even though it's a false positive (highest channel number is "9"), refer to "struct ep93xx_edma_data edma_m2p", we can avoid new warning by using snprintf().

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

Quoted 1 line
Quoted 1 line

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);
         |                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Fixes 4e8ad5ed845b ("dmaengine: cirrus: Convert to DT for Cirrus EP93xx")
---
 drivers/dma/ep93xx_dma.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/dma/ep93xx_dma.c +2 -2
index d084bd123c1c..b18cfb60857b 100644
@@ -1404,9 +1404,9 @@ static struct ep93xx_dma_engine *ep93xx_dma_of_probe(struct platform_device *pde
 		edmac->edma = edma;
 
 		if (edma->m2m)
-			sprintf(dma_clk_name, "m2m%u", i);
+			snprintf(dma_clk_name, sizeof(dma_clk_name), "m2m%u", i);
 		else
-			sprintf(dma_clk_name, "m2p%u", i);
+			snprintf(dma_clk_name, sizeof(dma_clk_name), "m2p%u", i);
 
 		edmac->clk = devm_clk_get(dev, dma_clk_name);
 		if (IS_ERR(edmac->clk)) {
Signature · 1 line
2.46.0
#1 lore raw
This patch was applied to soc/soc.git (for-next) by Arnd Bergmann <[email protected]>:

Hello:

This patch was applied to soc/soc.git (for-next)
by Arnd Bergmann <[email protected]>:

Quoted 15 lines · On Thu, 12 Sep 2024 16:21:06 +0200 you wrote:

Even though it's a false positive (highest channel number is "9"), refer to "struct ep93xx_edma_data edma_m2p", we can avoid new warning by using snprintf().

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

Quoted 1 line
Quoted 1 line

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);
         |                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Quoted 1 line

[...]

Here is the summary with links:
- dmaengine: cirrus: use snprintf() to calm down gcc 13.3.0

    https://git.kernel.org/soc/soc/c/d7333f9d3377

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html