[PATCH] Minor error in serial_configure
Jef Driesen
jef at libdivecomputer.org
Wed May 28 02:57:31 PDT 2014
On 2014-05-28 01:05, Linus Torvalds wrote:
> On Tue, May 27, 2014 at 6:16 AM, Jef Driesen <jef at libdivecomputer.org>
> wrote:
>>
>> So most likely, either this memcmp will have to be removed completely,
>> or at
>> least conditionally compiled on the ENABLE_PTY macro.
>
> I'd suggest just removing it entirely. The check just doesn't make
> sense, even ignoring the whole padding issue (and no, initializing it
> to zero doesn't fix it, since there might be random private members
> outside the spec) that might get initialized.
I also see no reason to keep the check. It only seem to cause more
problems than it solves. So let's just remove it.
BTW, Those private members are actually the reason why I used memcmp for
the comparison in the first place. There is basically no other way to
compare a struct that may contain "unknown" members. But I don't think
those private members would be problematic in this particular case. We
don't setup the termios structure from scratch, but initialize it with a
call to tcgetattr. If there are private members present, they would get
initialized there. But this no longer matters, once the check is gone
:-)
Jef
More information about the devel
mailing list