diff options
-rw-r--r-- | drivers/net/cxgb3/cxgb3_main.c | 12 |
1 files changed, 3 insertions, 9 deletions
diff --git a/drivers/net/cxgb3/cxgb3_main.c b/drivers/net/cxgb3/cxgb3_main.c index e3f1b8566495..066fd5b09fda 100644 --- a/drivers/net/cxgb3/cxgb3_main.c +++ b/drivers/net/cxgb3/cxgb3_main.c | |||
@@ -2311,15 +2311,9 @@ static int cxgb_extension_ioctl(struct net_device *dev, void __user *useraddr) | |||
2311 | if (copy_from_user(&t, useraddr, sizeof(t))) | 2311 | if (copy_from_user(&t, useraddr, sizeof(t))) |
2312 | return -EFAULT; | 2312 | return -EFAULT; |
2313 | /* Check t.len sanity ? */ | 2313 | /* Check t.len sanity ? */ |
2314 | fw_data = kmalloc(t.len, GFP_KERNEL); | 2314 | fw_data = memdup_user(useraddr + sizeof(t), t.len); |
2315 | if (!fw_data) | 2315 | if (IS_ERR(fw_data)) |
2316 | return -ENOMEM; | 2316 | return PTR_ERR(fw_data); |
2317 | |||
2318 | if (copy_from_user | ||
2319 | (fw_data, useraddr + sizeof(t), t.len)) { | ||
2320 | kfree(fw_data); | ||
2321 | return -EFAULT; | ||
2322 | } | ||
2323 | 2317 | ||
2324 | ret = t3_load_fw(adapter, fw_data, t.len); | 2318 | ret = t3_load_fw(adapter, fw_data, t.len); |
2325 | kfree(fw_data); | 2319 | kfree(fw_data); |