]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
dmaengine: loongson1-apb-dma: Fix the build warning caused by the size of pdev_irqname
authorKeguang Zhang <keguang.zhang@gmail.com>
Sat, 31 Aug 2024 09:41:09 +0000 (17:41 +0800)
committerVinod Koul <vkoul@kernel.org>
Mon, 2 Sep 2024 08:26:32 +0000 (13:56 +0530)
commite0bee4bcdc3238ebcae6e5960544b9e3d0a62abf
treee94e6ebe26ec24ff731d561c44f922623a1f39e6
parenta688efea0f2a084aee372e5b7b12d4d2d172f99a
dmaengine: loongson1-apb-dma: Fix the build warning caused by the size of pdev_irqname

drivers/dma/loongson1-apb-dma.c: In function 'ls1x_dma_probe':
drivers/dma/loongson1-apb-dma.c:531:42: warning: '%d' directive writing between 1 and 8 bytes into a region of size 2 [-Wformat-overflow=]
  531 |                 sprintf(pdev_irqname, "ch%d", id);
      |                                          ^~
In function 'ls1x_dma_chan_probe',
    inlined from 'ls1x_dma_probe' at drivers/dma/loongson1-apb-dma.c:605:8:
drivers/dma/loongson1-apb-dma.c:531:39: note: directive argument in the range [0, 19522579]
  531 |                 sprintf(pdev_irqname, "ch%d", id);
      |                                       ^~~~~~
drivers/dma/loongson1-apb-dma.c:531:17: note: 'sprintf' output between 4 and 11 bytes into a destination of size 4
  531 |                 sprintf(pdev_irqname, "ch%d", id);
      |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Fix the array size and use snprintf() instead of sprintf().

Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202408302108.xIR18jmD-lkp@intel.com/
Signed-off-by: Keguang Zhang <keguang.zhang@gmail.com>
Link: https://lore.kernel.org/r/20240831-fix-loongson1-dma-v1-1-91376d87695c@gmail.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>
drivers/dma/loongson1-apb-dma.c