[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20181126143245.GK10650@smile.fi.intel.com>
Date: Mon, 26 Nov 2018 16:32:45 +0200
From: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
To: Hans de Goede <hdegoede@...hat.com>
Cc: Darren Hart <dvhart@...radead.org>,
platform-driver-x86@...r.kernel.org,
"Rafael J. Wysocki" <rjw@...ysocki.net>,
linux-acpi@...r.kernel.org, Jonathan Cameron <jic23@...nel.org>,
Wolfram Sang <wsa@...-dreams.de>,
Mika Westerberg <mika.westerberg@...ux.intel.com>,
linux-i2c@...r.kernel.org,
Heikki Krogerus <heikki.krogerus@...ux.intel.com>,
linux-kernel@...r.kernel.org
Subject: Re: [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
Powered by blists - more mailing lists