From: Jia-Ju Bai <hidden> Date: 2021-03-04 14:20:18
When mlx5_is_fpga_lookaside() returns a non-zero value, no error
return code is assigned.
To fix this bug, err is assigned with -EINVAL as error return code.
Reported-by: TOTE Robot <redacted>
Signed-off-by: Jia-Ju Bai <redacted>
---
drivers/net/ethernet/mellanox/mlx5/core/fpga/core.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
@@ -198,8 +198,10 @@ int mlx5_fpga_device_start(struct mlx5_core_dev *mdev)mlx5_fpga_info(fdev,"FPGA card %s:%u\n",mlx5_fpga_name(fpga_id),fpga_id);/* No QPs if FPGA does not participate in net processing */-if(mlx5_is_fpga_lookaside(fpga_id))+if(mlx5_is_fpga_lookaside(fpga_id)){+err=-EINVAL;gotoout;+}mlx5_fpga_info(fdev,"%s(%d): image, version %u; SBU %06x:%04x version %d\n",mlx5_fpga_image_name(fdev->last_oper_image),
When mlx5_is_fpga_lookaside() returns a non-zero value, no error
return code is assigned.
To fix this bug, err is assigned with -EINVAL as error return code.
To me it looks like the current behavior is intentional.
Did you verify that it's actually an error condition if the
function returns true? Please don't blindly trust such code checkers.
@@ -198,8 +198,10 @@ int mlx5_fpga_device_start(struct mlx5_core_dev *mdev)mlx5_fpga_info(fdev,"FPGA card %s:%u\n",mlx5_fpga_name(fpga_id),fpga_id);/* No QPs if FPGA does not participate in net processing */-if(mlx5_is_fpga_lookaside(fpga_id))+if(mlx5_is_fpga_lookaside(fpga_id)){+err=-EINVAL;gotoout;+}mlx5_fpga_info(fdev,"%s(%d): image, version %u; SBU %06x:%04x version %d\n",mlx5_fpga_image_name(fdev->last_oper_image),
From: Leon Romanovsky <leon@kernel.org> Date: 2021-03-07 08:50:53
On Thu, Mar 04, 2021 at 06:18:14AM -0800, Jia-Ju Bai wrote:
When mlx5_is_fpga_lookaside() returns a non-zero value, no error
return code is assigned.
To fix this bug, err is assigned with -EINVAL as error return code.
Reported-by: TOTE Robot <redacted>
Signed-off-by: Jia-Ju Bai <redacted>
---
drivers/net/ethernet/mellanox/mlx5/core/fpga/core.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
Like Heiner said, the current code has correct behavior.
The mlx5_fpga_device_load_check() has same mlx5_is_fpga_lookaside()
check and it is not an error if it returns true.
NAK: Leon Romanovsky [off-list ref]
Thanks
On Sun, 2021-03-07 at 10:50 +0200, Leon Romanovsky wrote:
On Thu, Mar 04, 2021 at 06:18:14AM -0800, Jia-Ju Bai wrote:
quoted
When mlx5_is_fpga_lookaside() returns a non-zero value, no error
return code is assigned.
To fix this bug, err is assigned with -EINVAL as error return code.
Reported-by: TOTE Robot <redacted>
Signed-off-by: Jia-Ju Bai <redacted>
---
drivers/net/ethernet/mellanox/mlx5/core/fpga/core.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
Like Heiner said, the current code has correct behavior.
The mlx5_fpga_device_load_check() has same mlx5_is_fpga_lookaside()
check and it is not an error if it returns true.
NAK: Leon Romanovsky [off-list ref]
Thanks
Agreed, apparently this robot is looking for "goto {out|*err*}"
statements and treats all of them as errors, this is very unreliable,