Skip to contentSkip to conversation

cht_bsw_rt5645: Fix Kernel crash with strcpy

PATCH New Jenny TC 1 participant 1 message Jul 14, 2015

Subsystems (3)
lore
Share & tools
lore

Jenny TC

author
#0 lore raw

PATCH 1/1 cht_bsw_rt5645: Fix Kernel crash with strcpy

Kernel crash is observed when strcpy is used with const char*. The crash is reported only if driver is loaded as a module or the probe is called in the late stage of Kernel boot (EPROBE_DEFER). This is because Kernel enables read only protection near the end. Issue is addressed by replacing the strcpy with pointer assignment

---
 sound/soc/intel/boards/cht_bsw_rt5645.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/intel/boards/cht_bsw_rt5645.c +1 -1
index bdcaf46..3665d6c 100644
@@ -367,7 +367,7 @@ static int snd_cht_mc_probe(struct platform_device *pdev)
 	card->dev = &pdev->dev;
 	sprintf(codec_name, "i2c-%s:00", drv->acpi_card->codec_id);
 	/* set correct codec name */
-	strcpy((char *)card->dai_link[2].codec_name, codec_name);
+	card->dai_link[2].codec_name = codec_name;
 	snd_soc_card_set_drvdata(card, drv);
 	ret_val = devm_snd_soc_register_card(&pdev->dev, card);
 	if (ret_val) {
Signature · 1 line
1.7.9.5