Messages in this thread | | | Date | Wed, 31 Jan 2018 19:07:49 -0600 | From | "Gustavo A. R. Silva" <> | Subject | Re: [PATCH] tcp_lp: use 64-bit arithmetic instead of 32-bit |
| |
Hi Alan,
Quoting Alan Cox <gnomes@lxorguk.ukuu.org.uk>:
> On Wed, 31 Jan 2018 18:24:07 -0600 > "Gustavo A. R. Silva" <gustavo@embeddedor.com> wrote: > >> Cast to s64 some variables and a macro in order to give the >> compiler complete information about the proper arithmetic to >> use. Notice that these elements are used in contexts that >> expect expressions of type s64 (64 bits, signed). >> >> Currently such expression are being evaluated using 32-bit >> arithmetic. > > The question you need to ask is 'can it overflow 32bit maths', otherwise > you are potentially making the system do extra work for no reason. >
Yeah, I get your point and it seems that in this particular case there is no risk of a 32bit overflow, but in general and IMHO as the code evolves, the use of incorrect arithmetic may have security implications in the future, so I advocate for code correctness in this case.
Thanks -- Gustavo
| |