diff mbox series

ASoC: tas2781: Use strscpy instead of strcpy.

Message ID 20250110102007.2695452-1-zhangheng@kylinos.cn (mailing list archive)
State New
Headers show
Series ASoC: tas2781: Use strscpy instead of strcpy. | expand

Commit Message

Zhang Heng Jan. 10, 2025, 10:20 a.m. UTC
strcpy() performs no bounds checking on the destination buffer. This
could result in linear overflows beyond the end of the buffer, leading
to all kinds of misbehaviors.[1]

[1]: https://www.kernel.org/doc/html/latest/process/deprecated.html#strcpy

Signed-off-by: Zhang Heng <zhangheng@kylinos.cn>
---
 sound/soc/codecs/tas2781-i2c.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/sound/soc/codecs/tas2781-i2c.c b/sound/soc/codecs/tas2781-i2c.c
index fb8cd2284fe8..03d07ab8b41a 100644
--- a/sound/soc/codecs/tas2781-i2c.c
+++ b/sound/soc/codecs/tas2781-i2c.c
@@ -1658,7 +1658,7 @@  static void tasdevice_parse_dt(struct tasdevice_priv *tas_priv)
 		dev_err(tas_priv->dev, "%s Can't get reset GPIO\n",
 			__func__);
 
-	strcpy(tas_priv->dev_name, tasdevice_id[tas_priv->chip_id].name);
+	strscpy(tas_priv->dev_name, tasdevice_id[tas_priv->chip_id].name);
 }
 
 static int tasdevice_i2c_probe(struct i2c_client *i2c)