Re: [PATCH] i2c: dev: prevent adapter retries and timeout being set as minus value

From: Wolfram Sang
Date: Tue Jan 08 2019 - 14:37:48 EST


On Mon, Jan 07, 2019 at 08:37:41PM +0800, Yi Zeng wrote:
> If set adapter->retries to minus value from user space via ioctl,
> will make __i2c_transfer and __i2c_smbus_xfer jump the calling to
> adapter->algo->master_xfer and adapter->algo->smbus_xfer that
> registered by the underlying bus drivers, and return value 0 to
> all the callers. The bus driver will never be accessed anymore by
> all users, besides, the users may still get successful return value
> without any error or information log print out.
>
> If set adapter->timeout to minus value from user space via ioctl,
> will make the retrying loop in __i2c_transfer and __i2c_smbus_xfer
> always break after the the first try, due to the time_after always
> returns true.
>
> Signed-off-by: Yi Zeng <yizeng@xxxxxxxxxxxx>

Please run checkpatch.pl on your patch. It found two issues:

ERROR: code indent should use tabs where possible
#34: FILE: drivers/i2c/i2c-dev.c:480:
+ return -EINVAL;$

WARNING: please, no spaces at the start of a line
#34: FILE: drivers/i2c/i2c-dev.c:480:
+ return -EINVAL;$

Attachment: signature.asc
Description: PGP signature