[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <e9d19d97-7733-04aa-2c61-e7e367a97baa@gmail.com>
Date: Fri, 18 Sep 2020 09:09:37 +0100
From: Dan Scally <djrscally@...il.com>
To: Dan Carpenter <dan.carpenter@...cle.com>
Cc: yong.zhi@...el.com, sakari.ailus@...ux.intel.com,
bingbu.cao@...el.com, tian.shu.qiu@...el.com, mchehab@...nel.org,
gregkh@...uxfoundation.org, davem@...emloft.net, robh@...nel.org,
devel@...verdev.osuosl.org, jorhand@...ux.microsoft.com,
kieran.bingham@...asonboard.com, linux-kernel@...r.kernel.org,
linux-media@...r.kernel.org, kitakar@...il.com
Subject: Re: [RFC PATCH] Add bridge driver to connect sensors to CIO2 device
via software nodes on ACPI platforms
Ah, shoot - good spot, thanks
On 18/09/2020 09:03, Dan Carpenter wrote:
> I ran Smatch over the code and it spotted an off by one.
>
> On Wed, Sep 16, 2020 at 10:36:18PM +0100, Daniel Scally wrote:
>> +#define MAX_CONNECTED_DEVICES 4
>> +#define SWNODE_SENSOR_HID 0
>> +#define SWNODE_SENSOR_PORT 1
>> +#define SWNODE_SENSOR_ENDPOINT 2
>> +#define SWNODE_CIO2_PORT 3
>> +#define SWNODE_CIO2_ENDPOINT 4
>> +#define SWNODE_NULL_TERMINATOR 5
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>
>> +struct sensor {
>> + struct device *dev;
>> + struct software_node swnodes[5];
> ^^^^^^^^^^
> This needs to be 6 instead of 5 to prevent memory corruption.
>
>> + struct property_entry sensor_props[6];
>> + struct property_entry cio2_props[3];
>> + struct fwnode_handle *fwnode;
>> +};
>
>> + nodes[SWNODE_NULL_TERMINATOR] = SOFTWARE_NODE_NULL;
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> Here.
>
> regards,
> dan carpenter
>
Powered by blists - more mailing lists