This patch adds validity check of input pointer in regs dump API.
Fixes:
7a3f27cbf59b ("ethdev: add access to specific device info")
Fixes:
936eda25e8da ("net/hns3: support dump register")
Cc: stable@dpdk.org
Signed-off-by: Chengchang Tang <tangchengchang@huawei.com>
Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
uint32_t *data;
int ret;
- if (regs == NULL) {
- hns3_err(hw, "the input parameter regs is NULL!");
- return -EINVAL;
- }
-
ret = hns3_get_regs_length(hw, &length);
if (ret)
return ret;
struct rte_eth_dev *dev;
RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+ if (info == NULL)
+ return -EINVAL;
dev = &rte_eth_devices[port_id];
RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->get_reg, -ENOTSUP);
* @return
* - (0) if successful.
* - (-ENOTSUP) if hardware doesn't support.
+ * - (-EINVAL) if bad parameter.
* - (-ENODEV) if *port_id* invalid.
* - (-EIO) if device is removed.
* - others depends on the specific operations implementation.