From: Peng Zhang <peng.zh...@corigine.com> The original logic can not make sure the 'repr' pointer has valid value and the dereference of null pointer will cause a segment fault problem.
Fixes: eae7dadbe987 ("net/nfp: update link status reporting") Cc: james.hers...@corigine.com Cc: sta...@dpdk.org Signed-off-by: Peng Zhang <peng.zh...@corigine.com> Reviewed-by: Chaoyong He <chaoyong...@corigine.com> Reviewed-by: Long Wu <long...@corigine.com> --- drivers/net/nfp/flower/nfp_flower_ctrl.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/net/nfp/flower/nfp_flower_ctrl.c b/drivers/net/nfp/flower/nfp_flower_ctrl.c index de6e419cac..8cfafe91c8 100644 --- a/drivers/net/nfp/flower/nfp_flower_ctrl.c +++ b/drivers/net/nfp/flower/nfp_flower_ctrl.c @@ -441,6 +441,11 @@ nfp_flower_cmsg_port_mod_rx(struct nfp_app_fw_flower *app_fw_flower, return -EINVAL; } + if (repr == NULL) { + PMD_DRV_LOG(ERR, "Can not get 'repr' for port %#x", port); + return -EINVAL; + } + repr->link.link_duplex = RTE_ETH_LINK_FULL_DUPLEX; if ((msg->info & NFP_FLOWER_CMSG_PORT_MOD_INFO_LINK) != 0) repr->link.link_status = RTE_ETH_LINK_UP; -- 2.39.1