bus/ifpga: fix issue of accessing null address
PATCH 1/1 bus/ifpga: fix issue of accessing null address
In function ifpga_scan_one(), variable 'path' is NULL if device argument 'afu_bts' is not set, subsequent string copy with 'path' would lead to segmentation fault.
--- drivers/bus/ifpga/ifpga_bus.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/bus/ifpga/ifpga_bus.c +2 -1
@@ -135,6 +135,8 @@ struct rte_afu_device * goto end; } afu_pr_conf.pr_enable =1 ; +strlcpy (afu_pr_conf.bs_path, path, +sizeof (afu_pr_conf.bs_path)); }else { afu_pr_conf.pr_enable =0 ; }
@@ -174,7 +176,6 @@ struct rte_afu_device * rawdev->dev_ops->dev_start(rawdev)) goto end; -strlcpy (afu_pr_conf.bs_path, path,sizeof (afu_pr_conf.bs_path));if (rawdev->dev_ops && rawdev->dev_ops->firmware_load && rawdev->dev_ops->firmware_load(rawdev,
Signature · 1 line
1.8.3.1
Quoted 44 lines
-----Original Message-----
From: Huang, Wei <[email protected]>
Sent: Friday, March 17, 2023 4:44 AM
To: [email protected]; [email protected]; [email protected]
Cc: [email protected]; Xu, Rosen <[email protected]>; Zhang, Tianfei <[email protected]>; Zhang, Qi Z <[email protected]>; Huang, Wei <[email protected]>
Subject: [PATCH v1] bus/ifpga: fix issue of accessing null addressIn function
ifpga_scan_one(), variable 'path' is NULL if device argument 'afu_bts' is not set, subsequent string copy with 'path' would lead to segmentation fault.Fixes 6fa4aa2b3645 ("bus/ifpga: fix forcing optional devargs")Signed-off-by Wei Huang <[email protected]>--- drivers/bus/ifpga/ifpga_bus.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)drivers/bus/ifpga/ifpga_bus.c index renamed from drivers/bus/ifpga/ifpga_bus.c +0
-0bb943b5..07e316b 100644
drivers/bus/ifpga/ifpga_bus.c +2
-2@@ -135,6 +135,8 @@ struct rte_afu_device * goto end; } afu_pr_conf.pr_enable =1 ; +strlcpy (afu_pr_conf.bs_path, path, +sizeof (afu_pr_conf.bs_path)); }else { afu_pr_conf.pr_enable =0 ; }@@ -174,7 +176,6 @@ struct rte_afu_device * rawdev->dev_ops->dev_start(rawdev)) goto end; -strlcpy (afu_pr_conf.bs_path, path,sizeof (afu_pr_conf.bs_path));if (rawdev->dev_ops && rawdev->dev_ops->firmware_load && rawdev->dev_ops->firmware_load(rawdev, --
Quoted 1 line
1.8.3.1
It looks good for me.
Thomas Monjalon
AppliedQuoted 10 lines
Quoted 7 lines
In function
ifpga_scan_one(), variable 'path' is NULL if device argument 'afu_bts' is not set, subsequent string copy with 'path' would lead to segmentation fault.Fixes 6fa4aa2b3645 ("bus/ifpga: fix forcing optional devargs")Signed-off-by Wei Huang <[email protected]>It looks good for me.
Acked-by Tianfei Zhang <[email protected]>
Applied, thanks.
Hi,
Quoted 43 lines
-----Original Message-----
From: Huang, Wei <[email protected]>
Sent: Friday, March 17, 2023 4:44 AM
To: [email protected]; [email protected]; [email protected]
Cc: [email protected]; Xu, Rosen <[email protected]>; Zhang, Tianfei <[email protected]>; Zhang, Qi Z <[email protected]>; Huang, Wei <[email protected]>
Subject: [PATCH v1] bus/ifpga: fix issue of accessing null addressIn function
ifpga_scan_one(), variable 'path' is NULL if device argument 'afu_bts' is not set, subsequent string copy with 'path' would lead to segmentation fault.Fixes 6fa4aa2b3645 ("bus/ifpga: fix forcing optional devargs")Signed-off-by Wei Huang <[email protected]>--- drivers/bus/ifpga/ifpga_bus.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)drivers/bus/ifpga/ifpga_bus.c +2
-2@@ -135,6 +135,8 @@ struct rte_afu_device * goto end; } afu_pr_conf.pr_enable =1 ; +strlcpy (afu_pr_conf.bs_path, path, +sizeof (afu_pr_conf.bs_path)); }else { afu_pr_conf.pr_enable =0 ; }@@ -174,7 +176,6 @@ struct rte_afu_device * rawdev->dev_ops->dev_start(rawdev)) goto end; -strlcpy (afu_pr_conf.bs_path, path,sizeof (afu_pr_conf.bs_path));if (rawdev->dev_ops && rawdev->dev_ops->firmware_load && rawdev->dev_ops->firmware_load(rawdev, --
Quoted 1 line
1.8.3.1