* [PATCH v2] ASoC: cht_bsw_rt5645: Fix writing to string literal
@ 2016-02-23 8:50 Carlo Caione
2016-02-26 2:12 ` Mark Brown
2016-02-26 2:46 ` Applied "ASoC: cht_bsw_rt5645: Fix writing to string literal" to the asoc tree Mark Brown
0 siblings, 2 replies; 7+ messages in thread
From: Carlo Caione @ 2016-02-23 8:50 UTC (permalink / raw)
To: lgirdwood, broonie, vinod.koul, yang.a.fang, linux, alsa-devel
Cc: Carlo Caione
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/boards/cht_bsw_rt5645.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/sound/soc/intel/boards/cht_bsw_rt5645.c b/sound/soc/intel/boards/cht_bsw_rt5645.c
index 2d3afdd..a7b96a9 100644
--- a/sound/soc/intel/boards/cht_bsw_rt5645.c
+++ b/sound/soc/intel/boards/cht_bsw_rt5645.c
@@ -367,8 +367,12 @@ 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);
+ for (i = 0; i < ARRAY_SIZE(cht_dailink); i++)
+ if (!strcmp(card->dai_link[i].codec_name, "i2c-10EC5645:00"))
+ card->dai_link[i].codec_name = kstrdup(codec_name, GFP_KERNEL);
+
snd_soc_card_set_drvdata(card, drv);
ret_val = devm_snd_soc_register_card(&pdev->dev, card);
if (ret_val) {
--
2.5.0
^ permalink raw reply related [flat|nested] 7+ messages in thread* Re: [PATCH v2] ASoC: cht_bsw_rt5645: Fix writing to string literal
2016-02-23 8:50 [PATCH v2] ASoC: cht_bsw_rt5645: Fix writing to string literal Carlo Caione
@ 2016-02-26 2:12 ` Mark Brown
2016-03-03 11:32 ` Vinod Koul
2016-02-26 2:46 ` Applied "ASoC: cht_bsw_rt5645: Fix writing to string literal" to the asoc tree Mark Brown
1 sibling, 1 reply; 7+ messages in thread
From: Mark Brown @ 2016-02-26 2:12 UTC (permalink / raw)
To: Carlo Caione
Cc: alsa-devel, vinod.koul, lgirdwood, yang.a.fang, Carlo Caione,
linux
[-- Attachment #1.1: Type: text/plain, Size: 477 bytes --]
On Tue, Feb 23, 2016 at 09:50:20AM +0100, 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.
So how was the original code tested then...?
[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 473 bytes --]
[-- Attachment #2: Type: text/plain, Size: 0 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v2] ASoC: cht_bsw_rt5645: Fix writing to string literal
2016-02-26 2:12 ` Mark Brown
@ 2016-03-03 11:32 ` Vinod Koul
2016-03-03 12:47 ` Carlo Caione
2016-03-03 16:11 ` Pierre-Louis Bossart
0 siblings, 2 replies; 7+ messages in thread
From: Vinod Koul @ 2016-03-03 11:32 UTC (permalink / raw)
To: Mark Brown, Pierre-Louis Bossart
Cc: alsa-devel, yang.a.fang, lgirdwood, Carlo Caione, Carlo Caione,
linux
[-- Attachment #1.1: Type: text/plain, Size: 905 bytes --]
On Fri, Feb 26, 2016 at 11:12:10AM +0900, Mark Brown wrote:
> On Tue, Feb 23, 2016 at 09:50:20AM +0100, 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.
>
> So how was the original code tested then...?
I know systems using this are shipping so surprised to see this.
Carlo cna you please tell me the configuration where it is seen.
Also would be worth mentioning here that Pierre is working on a super fix
for this which involves removing this code and getting the right IDs from
BIOS, so we wont need this code.
Thanks
--
~Vinod
[-- Attachment #1.2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
[-- Attachment #2: Type: text/plain, Size: 0 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v2] ASoC: cht_bsw_rt5645: Fix writing to string literal
2016-03-03 11:32 ` Vinod Koul
@ 2016-03-03 12:47 ` Carlo Caione
2016-03-03 16:11 ` Pierre-Louis Bossart
1 sibling, 0 replies; 7+ messages in thread
From: Carlo Caione @ 2016-03-03 12:47 UTC (permalink / raw)
To: Vinod Koul
Cc: alsa-devel, Yang Fang, Pierre-Louis Bossart, Liam Girdwood,
Mark Brown, Carlo Caione, Linux Upstreaming Team
On Thu, Mar 3, 2016 at 12:32 PM, Vinod Koul <vinod.koul@intel.com> wrote:
> On Fri, Feb 26, 2016 at 11:12:10AM +0900, Mark Brown wrote:
>> On Tue, Feb 23, 2016 at 09:50:20AM +0100, 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.
>>
>> So how was the original code tested then...?
>
> I know systems using this are shipping so surprised to see this.
>
> Carlo cna you please tell me the configuration where it is seen.
Hi Vinod,
I'm working on the ECS EF20EA cherry-trail laptop. This is the used
configuration:
https://gist.github.com/carlocaione/925540bc7b04eff01aa8
Cheers,
--
Carlo Caione | +39.340.80.30.096 | Endless
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v2] ASoC: cht_bsw_rt5645: Fix writing to string literal
2016-03-03 11:32 ` Vinod Koul
2016-03-03 12:47 ` Carlo Caione
@ 2016-03-03 16:11 ` Pierre-Louis Bossart
2016-03-03 16:16 ` Carlo Caione
1 sibling, 1 reply; 7+ messages in thread
From: Pierre-Louis Bossart @ 2016-03-03 16:11 UTC (permalink / raw)
To: Vinod Koul, Mark Brown
Cc: alsa-devel, yang.a.fang, lgirdwood, Carlo Caione, Carlo Caione,
linux
On 3/3/16 5:32 AM, Vinod Koul wrote:
> On Fri, Feb 26, 2016 at 11:12:10AM +0900, Mark Brown wrote:
>> On Tue, Feb 23, 2016 at 09:50:20AM +0100, 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.
>>
>> So how was the original code tested then...?
>
> I know systems using this are shipping so surprised to see this.
>
> Carlo cna you please tell me the configuration where it is seen.
>
> Also would be worth mentioning here that Pierre is working on a super fix
> for this which involves removing this code and getting the right IDs from
> BIOS, so we wont need this code.
I am actually using the same code to find out which DAI fields need to
be replaced instead of hard-codec indices so the loop part is a good thing.
There is still a need to copy a string, be it a constant to generated
from the HID, into the codec_name field. I am not clear why strcpy()
works on all my systems and why kstrdup() is required. Is the kernel
issue really due to this string handling or to the bad index?
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v2] ASoC: cht_bsw_rt5645: Fix writing to string literal
2016-03-03 16:11 ` Pierre-Louis Bossart
@ 2016-03-03 16:16 ` Carlo Caione
0 siblings, 0 replies; 7+ messages in thread
From: Carlo Caione @ 2016-03-03 16:16 UTC (permalink / raw)
To: Pierre-Louis Bossart
Cc: alsa-devel, Vinod Koul, Liam Girdwood, Yang Fang, Mark Brown,
Carlo Caione, Carlo Caione, linux
On Thu, Mar 3, 2016 at 5:11 PM, Pierre-Louis Bossart
<pierre-louis.bossart@linux.intel.com> wrote:
> On 3/3/16 5:32 AM, Vinod Koul wrote:
>>
>> On Fri, Feb 26, 2016 at 11:12:10AM +0900, Mark Brown wrote:
>>>
>>> On Tue, Feb 23, 2016 at 09:50:20AM +0100, 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.
>>>
>>>
>>> So how was the original code tested then...?
>>
>>
>> I know systems using this are shipping so surprised to see this.
>>
>> Carlo cna you please tell me the configuration where it is seen.
>>
>> Also would be worth mentioning here that Pierre is working on a super fix
>> for this which involves removing this code and getting the right IDs from
>> BIOS, so we wont need this code.
>
>
> I am actually using the same code to find out which DAI fields need to be
> replaced instead of hard-codec indices so the loop part is a good thing.
> There is still a need to copy a string, be it a constant to generated from
> the HID, into the codec_name field. I am not clear why strcpy() works on all
> my systems and why kstrdup() is required. Is the kernel issue really due to
> this string handling or to the bad index?
In my tests using kstrdup() fixed the BUG issue and the bad indexing
fix was required to have the driver working correctly.
--
Carlo Caione
^ permalink raw reply [flat|nested] 7+ messages in thread
* Applied "ASoC: cht_bsw_rt5645: Fix writing to string literal" to the asoc tree
2016-02-23 8:50 [PATCH v2] ASoC: cht_bsw_rt5645: Fix writing to string literal Carlo Caione
2016-02-26 2:12 ` Mark Brown
@ 2016-02-26 2:46 ` Mark Brown
1 sibling, 0 replies; 7+ messages in thread
From: Mark Brown @ 2016-02-26 2:46 UTC (permalink / raw)
To: Carlo Caione, Mark Brown; +Cc: alsa-devel
The patch
ASoC: cht_bsw_rt5645: Fix writing to string literal
has been applied to the asoc tree at
git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git
All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying
to this mail.
Thanks,
Mark
>From c8560b7c917f8738f5d80dd516930edc1d05e4e4 Mon Sep 17 00:00:00 2001
From: Carlo Caione <carlo@endlessm.com>
Date: Tue, 23 Feb 2016 09:50:20 +0100
Subject: [PATCH] ASoC: cht_bsw_rt5645: Fix writing to string literal
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>
Signed-off-by: Mark Brown <broonie@kernel.org>
---
sound/soc/intel/boards/cht_bsw_rt5645.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/sound/soc/intel/boards/cht_bsw_rt5645.c b/sound/soc/intel/boards/cht_bsw_rt5645.c
index 2d3afddb0a2e..a7b96a9a4e0e 100644
--- a/sound/soc/intel/boards/cht_bsw_rt5645.c
+++ b/sound/soc/intel/boards/cht_bsw_rt5645.c
@@ -367,8 +367,12 @@ 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);
+ for (i = 0; i < ARRAY_SIZE(cht_dailink); i++)
+ if (!strcmp(card->dai_link[i].codec_name, "i2c-10EC5645:00"))
+ card->dai_link[i].codec_name = kstrdup(codec_name, GFP_KERNEL);
+
snd_soc_card_set_drvdata(card, drv);
ret_val = devm_snd_soc_register_card(&pdev->dev, card);
if (ret_val) {
--
2.7.0
^ permalink raw reply related [flat|nested] 7+ messages in thread
end of thread, other threads:[~2016-03-03 16:16 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-02-23 8:50 [PATCH v2] ASoC: cht_bsw_rt5645: Fix writing to string literal Carlo Caione
2016-02-26 2:12 ` Mark Brown
2016-03-03 11:32 ` Vinod Koul
2016-03-03 12:47 ` Carlo Caione
2016-03-03 16:11 ` Pierre-Louis Bossart
2016-03-03 16:16 ` Carlo Caione
2016-02-26 2:46 ` Applied "ASoC: cht_bsw_rt5645: Fix writing to string literal" to the asoc tree Mark Brown
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.