[prev in list] [next in list] [prev in thread] [next in thread]
List: busybox
Subject: Re: [PATCH] i2c_tools.c: add i2ctransfer utility
From: Nikolaus Voss <nv () vosn ! de>
Date: 2019-01-07 13:18:03
Message-ID: alpine.DEB.2.20.1901071416290.12575 () fox ! voss ! local
[Download RAW message or body]
[Attachment #2 (multipart/signed)]
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
["smime.p7s" (application/pkcs7-signature)]
_______________________________________________
busybox mailing list
busybox@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic