mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-12 21:57:43 +00:00
net: hns3: check msg_data before memcpy in hclgevf_send_mbx_msg
The value of msg_data may be NULL in some cases, which will cause errors reported by some compiler. So this patch adds a check to fix it. Signed-off-by: Weihang Li <liweihang@hisilicon.com> Signed-off-by: Peng Li <lipeng321@huawei.com> Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
c09ba48456
commit
0bae5cf25d
1 changed files with 2 additions and 1 deletions
|
@ -102,7 +102,8 @@ int hclgevf_send_mbx_msg(struct hclgevf_dev *hdev, u16 code, u16 subcode,
|
|||
~HCLGE_MBX_NEED_RESP_BIT;
|
||||
req->msg[0] = code;
|
||||
req->msg[1] = subcode;
|
||||
memcpy(&req->msg[2], msg_data, msg_len);
|
||||
if (msg_data)
|
||||
memcpy(&req->msg[2], msg_data, msg_len);
|
||||
|
||||
/* synchronous send */
|
||||
if (need_resp) {
|
||||
|
|
Loading…
Reference in a new issue