Commit 5e4cbaa7 authored by Lendacky, Thomas's avatar Lendacky, Thomas Committed by David S. Miller
Browse files

amd-xgbe: Fix possible uninitialized variable

The debugfs support in the driver uses a common routine to write the
debugfs values. In this routine, if the input file position is non-zero
then the write routine will not return an error and an output parameter
will not have been set. Because an error isn't returned an uninitialized
value will be written into a register.

Fix the common write routine to return an error if the input file position
is non-zero, which will propagate back to the caller.
Reported-by: default avatarDan Carpenter <>
Signed-off-by: default avatarTom Lendacky <>
Signed-off-by: default avatarDavid S. Miller <>
parent 54dbf3a5
......@@ -153,7 +153,7 @@ static ssize_t xgbe_common_write(const char __user *buffer, size_t count,
int ret;
if (*ppos != 0)
return 0;
return -EINVAL;
if (count >= sizeof(workarea))
return -ENOSPC;
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment