diff options
author | Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com> | 2024-01-10 23:27:17 +0100 |
---|---|---|
committer | Vinod Koul <vkoul@kernel.org> | 2024-01-19 12:37:58 +0100 |
commit | c4d6dcb3b6250ea546a952ad33382daf7cd32425 (patch) | |
tree | 9d94fc629ecca3b28f1959cb4b5c359de0b26ef8 /drivers/dma/st_fdma.c | |
parent | dmaengine: imx-sdma: fix Excess kernel-doc warnings (diff) | |
download | linux-c4d6dcb3b6250ea546a952ad33382daf7cd32425.tar.xz linux-c4d6dcb3b6250ea546a952ad33382daf7cd32425.zip |
dmaengine: sh: rz-dmac: Avoid format-overflow warning
The max channel count for RZ DMAC is 16, hence use u8 instead of unsigned
int and make the pdev_irqname string long enough to avoid the warning.
This fixes the below issue:
drivers/dma/sh/rz-dmac.c: In function ‘rz_dmac_probe’:
drivers/dma/sh/rz-dmac.c:770:34: warning: ‘%u’ directive writing between 1 and 10 bytes into a region of size 3 [-Wformat-overflow=]
770 | sprintf(pdev_irqname, "ch%u", index);
| ^~
In function ‘rz_dmac_chan_probe’,
inlined from ‘rz_dmac_probe’ at drivers/dma/sh/rz-dmac.c:910:9:
drivers/dma/sh/rz-dmac.c:770:31: note: directive argument in the range [0, 4294967294]
770 | sprintf(pdev_irqname, "ch%u", index);
| ^~~~~~
drivers/dma/sh/rz-dmac.c:770:9: note: ‘sprintf’ output between 4 and 13 bytes into a destination of size 5
770 | sprintf(pdev_irqname, "ch%u", index);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
While at it use scnprintf() instead of sprintf() to make the code
more robust.
Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Link: https://lore.kernel.org/r/20240110222717.193719-1-prabhakar.mahadev-lad.rj@bp.renesas.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>
Diffstat (limited to 'drivers/dma/st_fdma.c')
0 files changed, 0 insertions, 0 deletions