From: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
To: Carlo Caione <carlo@caione.org>,
lgirdwood@gmail.com, broonie@kernel.org, vinod.koul@intel.com,
yang.a.fang@intel.com, linux@endlessm.com,
alsa-devel@alsa-project.org
Cc: Carlo Caione <carlo@endlessm.com>
Subject: Re: [PATCH] SoC: cht_bsw_rt5645: Fix writing to string literal
Date: Thu, 18 Feb 2016 00:02:23 -0800 [thread overview]
Message-ID: <56C57A8F.9030306@linux.intel.com> (raw)
In-Reply-To: <1455572189-11724-1-git-send-email-carlo@caione.org>
On 2/15/16 1:36 PM, Carlo Caione wrote:
> From: Carlo Caione <carlo@endlessm.com>
>
> We cannot use strcpy() to write to a const char * location. This is
> causing a 'BUG: unable to handle kernel paging request' error at boot
> when using the cht-bsw-rt5645 driver.
>
> With this patch we also fix a wrong indexing in the driver where the
> codec_name of the wrong dai_link is being overwritten.
>
> Signed-off-by: Carlo Caione <carlo@endlessm.com>
> ---
> sound/soc/intel/atom/sst-atom-controls.h | 1 +
> sound/soc/intel/boards/cht_bsw_rt5645.c | 4 ++--
> 2 files changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/sound/soc/intel/atom/sst-atom-controls.h b/sound/soc/intel/atom/sst-atom-controls.h
> index e011311..6f88d1c 100644
> --- a/sound/soc/intel/atom/sst-atom-controls.h
> +++ b/sound/soc/intel/atom/sst-atom-controls.h
> @@ -30,6 +30,7 @@ enum {
> MERR_DPCM_AUDIO = 0,
> MERR_DPCM_DEEP_BUFFER,
> MERR_DPCM_COMPR,
> + MERR_DPCM_BE,
> };
>
> /* define a bit for each mixer input */
> diff --git a/sound/soc/intel/boards/cht_bsw_rt5645.c b/sound/soc/intel/boards/cht_bsw_rt5645.c
> index e6cf800..89b4c032 100644
> --- a/sound/soc/intel/boards/cht_bsw_rt5645.c
> +++ b/sound/soc/intel/boards/cht_bsw_rt5645.c
> @@ -282,7 +282,7 @@ static struct snd_soc_dai_link cht_dailink[] = {
> },
> /* CODEC<->CODEC link */
> /* back ends */
> - {
> + [MERR_DPCM_BE] = {
> .name = "SSP2-Codec",
> .be_id = 1,
> .cpu_dai_name = "ssp2-port",
> @@ -357,7 +357,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[MERR_DPCM_BE].codec_name = kstrdup(codec_name, GFP_KERNEL);
It's probably less problematic to find the index in a different way.
Adding a new definition in the platform driver doesn't seem quite right.
next prev parent reply other threads:[~2016-02-18 8:02 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-15 21:36 [PATCH] SoC: cht_bsw_rt5645: Fix writing to string literal Carlo Caione
2016-02-18 8:02 ` Pierre-Louis Bossart [this message]
2016-02-18 8:31 ` Carlo Caione
2016-02-20 15:01 ` Pierre-Louis Bossart
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=56C57A8F.9030306@linux.intel.com \
--to=pierre-louis.bossart@linux.intel.com \
--cc=alsa-devel@alsa-project.org \
--cc=broonie@kernel.org \
--cc=carlo@caione.org \
--cc=carlo@endlessm.com \
--cc=lgirdwood@gmail.com \
--cc=linux@endlessm.com \
--cc=vinod.koul@intel.com \
--cc=yang.a.fang@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).