lkml.org 
[lkml]   [2018]   [Nov]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v1 09/15] platform/x86: i2c-multi-instantiate: Count I2cSerialBus() resources
On Wed, Nov 21, 2018 at 01:03:35PM +0100, Hans de Goede wrote:
> On 20-11-18 16:59, Andy Shevchenko wrote:

> > - multi->num_clients = i;
> > + multi->num_clients = ret;
> > for (i = 0; i < multi->num_clients; i++) {
> > memset(&board_info, 0, sizeof(board_info));
>
> Now you end up indexing inst_data with i without checking that inst_data
> holds enough data. Not using all of inst_data in case there are less
> I2cSerialBus resources then inst_data entries is fine. But you need to
> deal with the case when there are more I2cSerialBus resources then inst_data
> entries, either by erroring out or ignoring the extra I2cSerialBus resources.

I think returning an error here is to be on safer side.

> Also it might be better to make the i2c_multi_inst_count_resources() function
> a generic helper under drivers/acpi, so that it can be used in other places,
> see my comments to the BOSC0200 patch.

I would rather to avoid touching BOSC0200 right now and keep that function
inside i2c-multi-instantiate.


--
With Best Regards,
Andy Shevchenko


\
 
 \ /
  Last update: 2018-11-26 15:33    [W:0.062 / U:0.196 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site