r8169: improve rtl_coalesce_choose_scale
authorHeiner Kallweit <hkallweit1@gmail.com>
Thu, 30 Apr 2020 19:57:32 +0000 (21:57 +0200)
committerDavid S. Miller <davem@davemloft.net>
Fri, 1 May 2020 00:39:15 +0000 (17:39 -0700)
commitcb9d97de05646de69b997da0137b94e00cba7f99
treea5db59a394f987769ff8e0caee3d3904cfa10dbd
parent6cf96dd4272537baf4ceab452f6276da1b8d82af
r8169: improve rtl_coalesce_choose_scale

The time limit provided by userspace is multiplied with 1000,
what could result in an overflow. Therefore change the time limit
parameter unit from ns to us, and avoid the problematic operation.
If there's no matching scale because provided time limit is too big,
return ERANGE instead of EINVAL to provide a hint to the user what's
wrong.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/realtek/r8169_main.c