Skip to content

Commit

Permalink
amd-xgbe: Fix debugfs compatibility change with kstrtouint
Browse files Browse the repository at this point in the history
The initial change from sscanf to kstrtouint broke backward
compatbility by using a base of "0" in the kstrtouint call.
This allowed for entering decimal, hexadecimal or octal as
input where previously the sscanf always interpreted the input
as hexadecimal.  Additionally, -EIO was returned on error prior
to this change and now it is whatever the error value that is
returned by kstrtouint.

Change the base value of the kstrtouint from 0 to 16 and return
-EIO on error.

Signed-off-by: Tom Lendacky <thomas.lendacky@amd.com>
Reported-by: Joe Perches <joe@perches.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Lendacky, Thomas authored and David S. Miller committed Jul 8, 2014
1 parent db55b62 commit f3f128d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/net/ethernet/amd/xgbe/xgbe-debugfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -165,9 +165,9 @@ static ssize_t xgbe_common_write(const char __user *buffer, size_t count,
return len;

workarea[len] = '\0';
ret = kstrtouint(workarea, 0, value);
ret = kstrtouint(workarea, 16, value);
if (ret)
return ret;
return -EIO;

return len;
}
Expand Down

0 comments on commit f3f128d

Please sign in to comment.