Skip to content

Commit

Permalink
ASoC: dmaengine: Replace strncpy() with strscpy_pad() for pcm->name
Browse files Browse the repository at this point in the history
While it is safe to use strncpy in this case, the advice is to move to
strscpy or strscpy_pad.

Suggested-by: Takashi Iwai <[email protected]>
Signed-off-by: Peter Ujfalusi <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Mark Brown <[email protected]>
  • Loading branch information
Peter Ujfalusi authored and broonie committed Sep 11, 2019
1 parent 73681f4 commit 48118a9
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions sound/soc/soc-generic-dmaengine-pcm.c
Original file line number Diff line number Diff line change
Expand Up @@ -308,9 +308,9 @@ static int dmaengine_pcm_new(struct snd_soc_pcm_runtime *rtd)
pcm->flags |= SND_DMAENGINE_PCM_FLAG_NO_RESIDUE;

if (rtd->pcm->streams[i].pcm->name[0] == '\0') {
strncpy(rtd->pcm->streams[i].pcm->name,
rtd->pcm->streams[i].pcm->id,
sizeof(rtd->pcm->streams[i].pcm->name));
strscpy_pad(rtd->pcm->streams[i].pcm->name,
rtd->pcm->streams[i].pcm->id,
sizeof(rtd->pcm->streams[i].pcm->name));
}
}

Expand Down

0 comments on commit 48118a9

Please sign in to comment.