cht_bsw_rt5645: Fix Kernel crash with strcpy
diff mbox

Message ID 1436891811-24759-1-git-send-email-jenny.tc@intel.com
State New
Headers show

Commit Message

Jenny TC July 14, 2015, 4:36 p.m. UTC
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

Signed-off-by: Jenny TC <jenny.tc@intel.com>
---
 sound/soc/intel/boards/cht_bsw_rt5645.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Patch
diff mbox

diff --git a/sound/soc/intel/boards/cht_bsw_rt5645.c b/sound/soc/intel/boards/cht_bsw_rt5645.c
index bdcaf46..3665d6c 100644
--- a/sound/soc/intel/boards/cht_bsw_rt5645.c
+++ b/sound/soc/intel/boards/cht_bsw_rt5645.c
@@ -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) {