All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] cht_bsw_rt5645: Fix Kernel crash with strcpy
@ 2015-07-14 16:36 Jenny TC
  0 siblings, 0 replies; only message in thread
From: Jenny TC @ 2015-07-14 16:36 UTC (permalink / raw)
  To: alsa-devel, yang.a.fang; +Cc: vinod.koul, Jenny TC

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(-)

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) {
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2015-07-14 16:36 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-07-14 16:36 [PATCH] cht_bsw_rt5645: Fix Kernel crash with strcpy Jenny TC

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.