Re: [PATCH net-next v3 3/3] net: dp83869: Add speed optimization feature

From: Dan Murphy
Date: Tue Sep 08 2020 - 10:17:48 EST


Jakub

On 9/5/20 1:38 PM, Jakub Kicinski wrote:
On Thu, 3 Sep 2020 06:42:59 -0500 Dan Murphy wrote:
+static int dp83869_set_downshift(struct phy_device *phydev, u8 cnt)
+{
+ int val, count;
+
+ if (cnt > DP83869_DOWNSHIFT_8_COUNT)
+ return -E2BIG;
ERANGE

This is not checking a range but making sure it is not bigger then 8.

IMO I would use ERANGE if the check was a boundary check for upper and lower bounds.

Dan