]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
ASoC: Intel: Replace deprecated strcpy() with strscpy()
authorSachin Mokashi <sachin.mokashi@intel.com>
Fri, 13 Jun 2025 16:35:30 +0000 (12:35 -0400)
committerMark Brown <broonie@kernel.org>
Mon, 16 Jun 2025 12:26:45 +0000 (13:26 +0100)
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: https://github.com/KSPP/linux/issues/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>
sound/soc/intel/boards/cht_bsw_rt5672.c

index aaef212cf44ec7b73c4ec5b845a41287628ee104..54c1894ee96ac569cdc9b84bc32ed2a5bd401968 100644 (file)
@@ -14,6 +14,7 @@
 #include <linux/platform_device.h>
 #include <linux/slab.h>
 #include <linux/clk.h>
+#include <linux/string.h>
 #include <sound/pcm.h>
 #include <sound/pcm_params.h>
 #include <sound/soc.h>
@@ -458,7 +459,7 @@ static int snd_cht_mc_probe(struct platform_device *pdev)
        if (!drv)
                return -ENOMEM;
 
-       strcpy(drv->codec_name, RT5672_I2C_DEFAULT);
+       strscpy(drv->codec_name, RT5672_I2C_DEFAULT, sizeof(drv->codec_name));
 
        /* find index of codec dai */
        for (i = 0; i < ARRAY_SIZE(cht_dailink); i++) {