Commit 46e3cafb authored by Dan Carpenter's avatar Dan Carpenter Committed by Greg Kroah-Hartman

USB: cxacru: fix an bounds check warning

This is a privileged operation so it doesn't matter much.  We use "tmp"
as an offset into an array.  If it were invalid we could read out of
bounds and trigger an oops if the memory is not mapped.  Plus it makes
static checkers complain.
Signed-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 1b83349f
...@@ -476,6 +476,8 @@ static ssize_t cxacru_sysfs_store_adsl_config(struct device *dev, ...@@ -476,6 +476,8 @@ static ssize_t cxacru_sysfs_store_adsl_config(struct device *dev,
return -EINVAL; return -EINVAL;
if (index < 0 || index > 0x7f) if (index < 0 || index > 0x7f)
return -EINVAL; return -EINVAL;
if (tmp < 0 || tmp > len - pos)
return -EINVAL;
pos += tmp; pos += tmp;
/* skip trailing newline */ /* skip trailing newline */
......
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