[4/6] net/hns3: fix the error length limit of maiblox response

Message ID 20191122120624.4963-5-xavier.huwei@tom.com (mailing list archive)
State Accepted, archived
Delegated to: Ferruh Yigit
Headers
Series Fixes for hns3 PMD driver |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation fail Compilation issues

Commit Message

Wei Hu (Xavier) Nov. 22, 2019, 12:06 p.m. UTC
  From: Chengchang Tang <tangchengchang@hisilicon.com>

This patch removes the macro 'HNS3_REG_MSG_DATA_OFFSET' which is used to
prevent the array from accessing violation and it limits the response data
length to be 4. but the limit value is too short to get some longer
information such as 6 byte MAC address.

This patch modify the length of response data from mailbox to allows the
response data length to be 8. So that the VF driver could get more data
from PF drvier by mailbox.

Fixes: 463e748964f5 ("net/hns3: support mailbox")
Cc: stable@dpdk.org

Signed-off-by: Chengchang Tang <tangchengchang@hisilicon.com>
Signed-off-by: Wei Hu (Xavier) <xavier.huwei@huawei.com>
---
 drivers/net/hns3/hns3_mbx.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
  

Patch

diff --git a/drivers/net/hns3/hns3_mbx.c b/drivers/net/hns3/hns3_mbx.c
index 2bfd97415..c1647af4b 100644
--- a/drivers/net/hns3/hns3_mbx.c
+++ b/drivers/net/hns3/hns3_mbx.c
@@ -24,7 +24,6 @@ 
 #include "hns3_logs.h"
 #include "hns3_intr.h"
 
-#define HNS3_REG_MSG_DATA_OFFSET	4
 #define HNS3_CMD_CODE_OFFSET		2
 
 static const struct errno_respcode_map err_code_map[] = {
@@ -320,8 +319,7 @@  hns3_dev_handle_mbx_msg(struct hns3_hw *hw)
 			resp->resp_status = hns3_resp_to_errno(req->msg[3]);
 
 			temp = (uint8_t *)&req->msg[4];
-			for (i = 0; i < HNS3_MBX_MAX_RESP_DATA_SIZE &&
-			     i < HNS3_REG_MSG_DATA_OFFSET; i++) {
+			for (i = 0; i < HNS3_MBX_MAX_RESP_DATA_SIZE; i++) {
 				resp->additional_info[i] = *temp;
 				temp++;
 			}