Hi Dan,

On Thu, Oct 23, 2014 at 05:58:13PM +0300, Dan Carpenter wrote:
> Hello Duson Lin,
> 
> The patch 29fbd64b0fd2: "Input: add driver for Elan I2C/SMbus
> touchpad" from Oct 3, 2014, leads to the following static checker
> warning:

Can you copy committer on such reports as well please?

> 
>       drivers/input/mouse/elan_i2c_smbus.c:372 elan_smbus_prepare_fw_update()
>       warn: sizeof(NUMBER)?
> 
> drivers/input/mouse/elan_i2c_smbus.c
>    365                  /*
>    366                   * Read back password to make sure we enabled flash
>    367                   * successfully.
>    368                   */
>    369                  len = i2c_smbus_read_block_data(client,
>    370                                                  
> ETP_SMBUS_IAP_PASSWORD_READ,
>    371                                                  val);
>    372                  if (len != sizeof(ETP_SMBUS_IAP_PASSWORD)) {
>                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> sizeof(int) is 4.
> val is a 3 byte array.
> If we read 4 bytes then we are writing beyond the end of the val[]
> array.

We should be checking sizeof(u16) here, I'll fix it up.

Thanks.

-- 
Dmitry
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to