Skip to content

Commit

Permalink
fsl_qbman: usdpaa: clear ioctl_dma_map string buffers
Browse files Browse the repository at this point in the history
Clear all string buffers memory locations in ioctl_dma_map before using strncpy to copy the string name

Signed-off-by: Florinel Iordache <florinel.iordache@nxp.com>
  • Loading branch information
florineliordache committed Apr 26, 2021
1 parent ebafc8f commit 1db839b
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion drivers/staging/fsl_qbman/fsl_usdpaa.c
Original file line number Diff line number Diff line change
Expand Up @@ -1157,7 +1157,8 @@ static long ioctl_dma_map(struct file *fp, struct ctx *ctx,
if (i->did_create) {
size_t name_len = 0;
start_frag->flags = i->flags;
strncpy(start_frag->name, i->name, USDPAA_DMA_NAME_MAX);
memset(start_frag->name, '\0', USDPAA_DMA_NAME_MAX);
strncpy(start_frag->name, i->name, USDPAA_DMA_NAME_MAX - 1);
name_len = strnlen(start_frag->name, USDPAA_DMA_NAME_MAX);
if (name_len >= USDPAA_DMA_NAME_MAX) {
ret = -EFAULT;
Expand Down

0 comments on commit 1db839b

Please sign in to comment.