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

Wei Hu (Xavier) xavier.huwei at tom.com
Fri Nov 22 13:06:22 CET 2019


From: Chengchang Tang <tangchengchang at 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 at dpdk.org

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

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++;
 			}
-- 
2.23.0



More information about the dev mailing list