lkml.org 
[lkml]   [2017]   [Apr]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH RESEND] regulator: rn5t618: Fix out of bounds array access
2017-04-16 9:12 GMT+08:00 Axel Lin <axel.lin@ingics.com>:
> 2017-04-16 0:53 GMT+08:00 Stefan Agner <stefan@agner.ch>:
>> On 2017-04-15 07:52, Axel Lin wrote:
>>> The commit "regulator: rn5t618: Add RN5T567 PMIC support" added
>>> RN5T618_DCDC4 to the enum, then RN5T618_REG_NUM is also changed.
>>> So for rn5t618, there is out of bounds array access when checking
>>> regulators[i].name in the for loop.
>>
>> I use designated initializers ([RN5T618_##rid] = {..), which guarantee
>> that the non initialized elements are zero. The highest element LDORTC2
>> is defined, hence the length of the array should be RN5T618_REG_NUM.
>
> ok, I missed that. Then current code is fine.
I just realize my patch is wrong due to the use of designated initializers.

Regards,
Axel

\
 
 \ /
  Last update: 2017-04-16 05:31    [W:0.182 / U:0.208 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site