[alsa-devel] [PATCH v2] ASoC: cht_bsw_rt5645: Fix writing to string literal

Carlo Caione carlo at caione.org
Thu Mar 3 17:16:29 CET 2016


On Thu, Mar 3, 2016 at 5:11 PM, Pierre-Louis Bossart
<pierre-louis.bossart at 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 at 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


More information about the Alsa-devel mailing list