lkml.org 
[lkml]   [2016]   [Oct]   [31]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCHv6 08/11] i2c: match vendorless strings on the internal string length
From
Date
On 2016-10-26 10:53, Lee Jones wrote:
> On Tue, 25 Oct 2016, Kieran Bingham wrote:
>
>> If a user provides a shortened string to match a device to the sysfs i2c
>> interface it will match on the first string that contains that string
>> prefix.
>>
>> for example:
>> echo a 0x68 > /sys/bus/i2c/devices/i2c-2/new_device
>>
>> will match as3711, as3722, and ak8975 incorrectly.
>>
>> Signed-off-by: Kieran Bingham <kieran@bingham.xyz>
>
> Acked-by: Lee Jones <lee.jones@linaro.org>
>
>> ---
>> drivers/i2c/i2c-core.c | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c
>> index 01bce56f733a..50c9cfdb87b7 100644
>> --- a/drivers/i2c/i2c-core.c
>> +++ b/drivers/i2c/i2c-core.c
>> @@ -1708,7 +1708,7 @@ i2c_of_match_device_strip_vendor(const struct of_device_id *matches,
>> else
>> name++;
>>
>> - if (!strncasecmp(client->name, name, strlen(client->name)))
>> + if (!strncasecmp(client->name, name, strlen(name)))
>> return matches;
>> }
>>
>

Is that really so much better?

With this patch
echo as3711CRAP 0x68 > /sys/...
will match as3711.

What if there is some as37112 driver that is the real target?

Cheers,
Peter

\
 
 \ /
  Last update: 2016-10-31 15:11    [W:0.275 / U:0.008 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site