Skip to content

Commit 47972c1

Browse files
mokashisachinbroonie
authored andcommitted
ASoC: Intel: Replace deprecated strcpy() with strscpy()
strcpy() is deprecated, use strscpy() instead. As strcpy() performs no bounds checking on the destination buffer. This could result in buffer overflow. The safe replacement is strscpy(). Link: KSPP#88 Signed-off-by: Sachin Mokashi <sachin.mokashi@intel.com> Link: https://patch.msgid.link/20250613163530.1165690-1-sachin.mokashi@intel.com Signed-off-by: Mark Brown <broonie@kernel.org>
1 parent e7af416 commit 47972c1

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

sound/soc/intel/boards/cht_bsw_rt5672.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
#include <linux/platform_device.h>
1515
#include <linux/slab.h>
1616
#include <linux/clk.h>
17+
#include <linux/string.h>
1718
#include <sound/pcm.h>
1819
#include <sound/pcm_params.h>
1920
#include <sound/soc.h>
@@ -458,7 +459,7 @@ static int snd_cht_mc_probe(struct platform_device *pdev)
458459
if (!drv)
459460
return -ENOMEM;
460461

461-
strcpy(drv->codec_name, RT5672_I2C_DEFAULT);
462+
strscpy(drv->codec_name, RT5672_I2C_DEFAULT, sizeof(drv->codec_name));
462463

463464
/* find index of codec dai */
464465
for (i = 0; i < ARRAY_SIZE(cht_dailink); i++) {

0 commit comments

Comments
 (0)