summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--net/core/ethtool.c16
1 files changed, 7 insertions, 9 deletions
diff --git a/net/core/ethtool.c b/net/core/ethtool.c
index aa8978ac47d2..c834cb29f682 100644
--- a/net/core/ethtool.c
+++ b/net/core/ethtool.c
@@ -561,19 +561,17 @@ static int ethtool_copy_validate_indir(u32 *indir, void __user *useraddr,
struct ethtool_rxnfc *rx_rings,
u32 size)
{
- int ret = 0, i;
+ int i;
if (copy_from_user(indir, useraddr, size * sizeof(indir[0])))
- ret = -EFAULT;
+ return -EFAULT;
/* Validate ring indices */
- for (i = 0; i < size; i++) {
- if (indir[i] >= rx_rings->data) {
- ret = -EINVAL;
- break;
- }
- }
- return ret;
+ for (i = 0; i < size; i++)
+ if (indir[i] >= rx_rings->data)
+ return -EINVAL;
+
+ return 0;
}
static noinline_for_stack int ethtool_get_rxfh_indir(struct net_device *dev,