[PATCH] i2c_tools.c: add i2ctransfer utility
Nikolaus Voss
nv at vosn.de
Mon Jan 7 13:18:03 UTC 2019
Hi Xabier,
On Mon, 7 Jan 2019, Xabier Oneca -- xOneca wrote:
>>>> + while (*++argv) {
>>>> + char *arg_ptr = *argv;
>>>> + unsigned long len, raw_data;
>>>> + __u16 flags;
>>>> + __u8 data, *buf;
>>>> + char *end;
>>>> +
>>>> + if (nmsgs > I2C_RDWR_IOCTL_MAX_MSGS)
>>>> + bb_error_msg_and_die("Error: Too many messages (max: %d)\n",
>>>> + I2C_RDWR_IOCTL_MAX_MSGS);
>>>
>>> Off-by-one error? Seems you meant to use >=.
>>
>> The code is actually correct, as nmsgs is incremented below after
>> writing to msgs[nmsgs] and nmsgs == I2C_RDWR_IOCTL_MAX_MSGS is valid.
>
> Sorry, I don't see how can here nmsgs == I2C_RDWR_IOCTL_MAX_MSGS be
> valid. nmsgs is the array index, so it can never reach
> I2C_RDWR_IOCTL_MAX_MSGS.
you're right of course... I'll correct that.
Thanks,
Nikolaus
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 3493 bytes
Desc: S/MIME Cryptographic Signature
URL: <http://lists.busybox.net/pipermail/busybox/attachments/20190107/543d22de/attachment.p7s>
More information about the busybox
mailing list