提交 45d04359 编写于 作者: J Jacob Keller 提交者: Jeff Kirsher

i40e: avoid large memcpy by assigning struct

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: NJacob Keller <jacob.e.keller@intel.com>
Reviewed-by: NJesse Brandeburg <jesse.brandeburg@intel.com>
Tested-by: NAndrew Bowers <andrewx.bowers@intel.com>
Signed-off-by: NJeff Kirsher <jeffrey.t.kirsher@intel.com>
上级 c40918c3
......@@ -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);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册