Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1624160
| From | Stefan Agner <stefan@agner.ch> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH RESEND] regulator: rn5t618: Fix out of bounds array access |
| Date | 2017-04-16 07:40 +0200 |
| Message-ID | <twL4J-8hc-1@gated-at.bofh.it> (permalink) |
| References | <twxl7-7NQ-3@gated-at.bofh.it> <twzdf-zg-3@gated-at.bofh.it> <twH17-5Gh-1@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On 2017-04-15 18:12, Axel Lin wrote:
> 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.
> Though the meaing of RN5T618_REG_NUM seems misleading to me as different
> variant has differnt number of regulators.
Yeah I admit the code is somewhat unobvious as it is now. But it allowed
me to add RN5T567 support without changing the existing array and the
preprocessor macro.
--
Stefan
Back to linux.kernel | Previous | Next — Previous in thread | Find similar | Unroll thread
[PATCH RESEND] regulator: rn5t618: Fix out of bounds array access Axel Lin <axel.lin@ingics.com> - 2017-04-15 17:00 +0200
Re: [PATCH RESEND] regulator: rn5t618: Fix out of bounds array access Stefan Agner <stefan@agner.ch> - 2017-04-15 19:00 +0200
Re: [PATCH RESEND] regulator: rn5t618: Fix out of bounds array access Axel Lin <axel.lin@ingics.com> - 2017-04-16 03:20 +0200
Re: [PATCH RESEND] regulator: rn5t618: Fix out of bounds array access Axel Lin <axel.lin@ingics.com> - 2017-04-16 05:40 +0200
Re: [PATCH RESEND] regulator: rn5t618: Fix out of bounds array access Stefan Agner <stefan@agner.ch> - 2017-04-16 07:40 +0200
csiph-web