[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAFRkauAspyOWOHrEdP2AoLv32aiaw_3eDP04SJS8zJoeuOay2Q@mail.gmail.com>
Date: Sun, 16 Apr 2017 09:12:24 +0800
From: Axel Lin <axel.lin@...ics.com>
To: Stefan Agner <stefan@...er.ch>
Cc: Lee Jones <lee.jones@...aro.org>,
Marcel Ziswiler <marcel.ziswiler@...adex.com>,
Mark Brown <broonie@...nel.org>,
Liam Girdwood <lgirdwood@...il.com>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH RESEND] regulator: rn5t618: Fix out of bounds array access
2017-04-16 0:53 GMT+08:00 Stefan Agner <stefan@...er.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.
Thanks for the review,
Axel
Powered by blists - more mailing lists