On Monday 29 June 2015 11:47:00 Antonio Quartulli wrote:
On 21/06/15 14:42, Sven Eckelmann wrote:
The TVLV for the gw_bandwidth stores everything as u32. But the gw_bandwidth reads the signed long which limits the maximum value to (2 ** 31 - 1) on systems with 4 byte long. Also the input value is always converted from either Mibit/s or Kibit/s to 100Kibit/s. This reduces the values even further when the user sets it via the default unit Kibit/s. It may even cause an integer overflow and end up with a value the user never intended.
Instead read the values as u64, check for possible overflows, do the unit adjustments and then reduce the size to u32.
Signed-off-by: Sven Eckelmann sven@narfation.org
v2:
- rebased on current master
shouldn't this patch be for maint as it is also fixing a potential overflow issue?
Only the configuration for users is not correctly stored. For example 4294967296Mbit would result in 0.1 Mbit instead of showing a failure. This is hopefully not the biggest problem.
Just tell me if you want it resubmitted against maint (Linux 4.1.x).
Kind regards, Sven