Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1604655

[PATCH] i40e: fix memcpy with swapped arguments

From Colin King <colin.king@canonical.com>
Newsgroups linux.kernel
Subject [PATCH] i40e: fix memcpy with swapped arguments
Date 2017-03-20 15:50 +0100
Message-ID <tn6Nb-67a-11@gated-at.bofh.it> (permalink)
Organization linux.* mail to news gateway

Show all headers | View raw


From: Colin Ian King <colin.king@canonical.com>

The current code copies an uninitialized params into
cdev->lan_info.params and then passes the uninitialized params
to the call cdev->client->ops->l2_param_change.  I believe the
order of the source and destination in the memcpy is the wrong
way around and should be swapped.

Detected with static analysis by cppcheck

Fixes: 0ef2d5afb12d ("i40e: KISS the client interface")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 drivers/net/ethernet/intel/i40e/i40e_client.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/intel/i40e/i40e_client.c b/drivers/net/ethernet/intel/i40e/i40e_client.c
index a9f0d22a7cf4..191580ed946d 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_client.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_client.c
@@ -147,7 +147,7 @@ void i40e_notify_client_of_l2_param_changes(struct i40e_vsi *vsi)
 		dev_dbg(&vsi->back->pdev->dev, "Client is not open, abort l2 param change\n");
 		return;
 	}
-	memcpy(&cdev->lan_info.params, &params, sizeof(struct i40e_params));
+	memcpy(&params, &cdev->lan_info.params, sizeof(struct i40e_params));
 	cdev->client->ops->l2_param_change(&cdev->lan_info, cdev->client,
 					   &params);
 }
-- 
2.11.0

Back to linux.kernel | Previous | NextNext in thread | Find similar | Unroll thread


Thread

[PATCH] i40e: fix memcpy with swapped arguments Colin King <colin.king@canonical.com> - 2017-03-20 15:50 +0100
  RE: [Intel-wired-lan] [PATCH] i40e: fix memcpy with swapped  arguments "Keller, Jacob E" <jacob.e.keller@intel.com> - 2017-03-21 00:40 +0100

csiph-web