Okay -----Original Message----- From: Xu, Rosen Sent: Wednesday, April 17, 2019 3:14 PM To: Pei, Andy <[email protected]>; [email protected] Cc: Kovacevic, Marko <[email protected]>; [email protected]; [email protected] Subject: RE: [PATCH] raw/ifpga: fix fd leak in rte fpga do pr
Hi, > -----Original Message----- > From: Pei, Andy > Sent: Wednesday, April 17, 2019 14:49 > To: [email protected] > Cc: Pei, Andy <[email protected]>; Xu, Rosen <[email protected]>; > Kovacevic, Marko <[email protected]>; [email protected]; > [email protected] > Subject: [PATCH] raw/ifpga: fix fd leak in rte fpga do pr Pls use raw/ifpga_rawdev prefix. I suggest you to run ./devtools/check-git-log.sh -1 before you sending patch. > In rte_fpga_do_pr() function, if 'stat' returns error, > rte_fpga_do_pr() returns -EINVAL without closing the 'file_fd' that > has been opened. > After this patch, 'file_fd' is closed before rte_fpga_do_pr() returns > -EINVAL when 'stat' returns error Pls put this in the commit message: Coverity issue: 279441 > Fixes: ef1e8ede3da5 ("raw/ifpga: add Intel FPGA bus rawdev driver") > Cc: [email protected] > Cc: [email protected] > Cc: [email protected] > Cc: [email protected] > Cc: [email protected] > > Signed-off-by: Andy Pei <[email protected]> > --- > --- > drivers/raw/ifpga_rawdev/ifpga_rawdev.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/drivers/raw/ifpga_rawdev/ifpga_rawdev.c > b/drivers/raw/ifpga_rawdev/ifpga_rawdev.c > index da772d0..eff001b 100644 > --- a/drivers/raw/ifpga_rawdev/ifpga_rawdev.c > +++ b/drivers/raw/ifpga_rawdev/ifpga_rawdev.c > @@ -244,7 +244,8 @@ > if (ret) { > IFPGA_RAWDEV_PMD_ERR("stat on bitstream file > failed: %s\n", > file_name); > - return -EINVAL; > + ret = -EINVAL; > + goto close_fd; > } > buffer_size = file_stat.st_size; > IFPGA_RAWDEV_PMD_INFO("bitstream file size: %zu\n", buffer_size); > -- > 1.8.3.1

