Why the need to change arg before comparing it with a constant? Let the
compiler do the work:
if (ax25_ctl.arg > ULONG_MAX / HZ && ...
Kevin
i like this because it prevents a wrap around for stupid ax25_ctl.arg values but will not help when
ax25_ctl.arg * HZ is used later. NTL i think HZ does not need to be constant these days but i am not an
expert on that area.
re,
wh
From: Kevin Dawson <hidden> Date: 2009-10-13 21:50:15
walter harms wrote:
Kevin Dawson schrieb:
quoted
if (ax25_ctl.arg > ULONG_MAX / HZ && ...
i like this because it prevents a wrap around for stupid ax25_ctl.arg values but will not help when
ax25_ctl.arg * HZ is used later. NTL i think HZ does not need to be constant these days but i am not an
expert on that area.
I don't have a kernel source tree at the moment, so I haven't seen where
it's used, but the same size-limiting principle using divisions would
apply whether you have constants, variables or function calls.
If ax25_ctl.arg * HZ is used later, one should arrange that the thread
won't get that far if it has already been deemed an excessive value.
Kevin
struct ax25_ctl_struct member `arg' is unsigned and cannot be less
than 0.
Signed-off-by: Roel Kluin <redacted>
---
Op 12-10-09 23:58, Kevin Dawson schreef: