Skip to content

Commit 3a5a8a2

Browse files
tiwaivinodkoul
authored andcommitted
dmaengine: ppc4xx: Use scnprintf() for avoiding potential buffer overflow
Since snprintf() returns the would-be-output size instead of the actual output size, the succeeding calls may go beyond the given buffer limit. Fix it by replacing with scnprintf(). Signed-off-by: Takashi Iwai <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Vinod Koul <[email protected]>
1 parent 91124ac commit 3a5a8a2

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/dma/ppc4xx/adma.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4303,7 +4303,7 @@ static ssize_t devices_show(struct device_driver *dev, char *buf)
43034303
for (i = 0; i < PPC440SPE_ADMA_ENGINES_NUM; i++) {
43044304
if (ppc440spe_adma_devices[i] == -1)
43054305
continue;
4306-
size += snprintf(buf + size, PAGE_SIZE - size,
4306+
size += scnprintf(buf + size, PAGE_SIZE - size,
43074307
"PPC440SP(E)-ADMA.%d: %s\n", i,
43084308
ppc_adma_errors[ppc440spe_adma_devices[i]]);
43094309
}

0 commit comments

Comments
 (0)