]> git.proxmox.com Git - mirror_ubuntu-zesty-kernel.git/commitdiff
i40e: avoid large memcpy by assigning struct
authorJacob Keller <jacob.e.keller@intel.com>
Mon, 4 Jan 2016 18:33:11 +0000 (10:33 -0800)
committerTim Gardner <tim.gardner@canonical.com>
Wed, 6 Apr 2016 09:20:27 +0000 (10:20 +0100)
BugLink: http://bugs.launchpad.net/bugs/1547674
Assign the i40e_pf structure directly instead of using a large memcpy,
which avoids a sparse warning and lets the compiler optimize the copy
since it knows the size of the structure in advance.

Change-ID: I17604e23be2616521eb760290befcb767b52b3f7
Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
Reviewed-by: Jesse Brandeburg <jesse.brandeburg@intel.com>
Tested-by: Andrew Bowers <andrewx.bowers@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
(cherry picked from net-next commit 45d043597d2d0e780e768866c6fbfe8dbee5f2cf)
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
drivers/net/ethernet/intel/i40e/i40e_debugfs.c

index 7aae0561c9c5a4eb8721b593c6bab4123552d876..3948587a047c60a01c0c13ccc48d509015f0a75c 100644 (file)
@@ -185,9 +185,11 @@ static ssize_t i40e_dbg_dump_write(struct file *filp,
                if (i40e_dbg_prep_dump_buf(pf, buflen)) {
                        p = i40e_dbg_dump_buf;
 
-                       len = sizeof(struct i40e_pf);
-                       memcpy(p, pf, len);
-                       p += len;
+                       /* avoid use of memcpy here due to sparse warning
+                        * about copy size.
+                        */
+                       *((struct i40e_pf *)p) = *pf;
+                       p += sizeof(struct i40e_pf);
 
                        len = (sizeof(struct i40e_aq_desc)
                                        * pf->hw.aq.num_asq_entries);