diff options
author | Ke Li <[email protected]> | 2020-10-22 02:41:46 -0400 |
---|---|---|
committer | Jakub Kicinski <[email protected]> | 2020-10-22 12:18:25 -0700 |
commit | 700465fd338fe5df08a1b2e27fa16981f562547f (patch) | |
tree | 23e90f011ffc4683537eaac1b2322fe4ee4390db /tools/perf/scripts/python/exported-sql-viewer.py | |
parent | 594850ca439d036173ace66e7f0d022f132f70a8 (diff) |
net: Properly typecast int values to set sk_max_pacing_rate
In setsockopt(SO_MAX_PACING_RATE) on 64bit systems, sk_max_pacing_rate,
after extended from 'u32' to 'unsigned long', takes unintentionally
hiked value whenever assigned from an 'int' value with MSB=1, due to
binary sign extension in promoting s32 to u64, e.g. 0x80000000 becomes
0xFFFFFFFF80000000.
Thus inflated sk_max_pacing_rate causes subsequent getsockopt to return
~0U unexpectedly. It may also result in increased pacing rate.
Fix by explicitly casting the 'int' value to 'unsigned int' before
assigning it to sk_max_pacing_rate, for zero extension to happen.
Fixes: 76a9ebe811fb ("net: extend sk_pacing_rate to unsigned long")
Signed-off-by: Ji Li <[email protected]>
Signed-off-by: Ke Li <[email protected]>
Reviewed-by: Eric Dumazet <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Jakub Kicinski <[email protected]>
Diffstat (limited to 'tools/perf/scripts/python/exported-sql-viewer.py')
0 files changed, 0 insertions, 0 deletions