git.droids-corp.org
/
dpdk.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
1348938
)
raw/ifpga/base: check lseek failure
author
Wei Huang
<wei.huang@intel.com>
Wed, 17 Mar 2021 08:21:34 +0000
(
04:21
-0400)
committer
Qi Zhang
<qi.z.zhang@intel.com>
Thu, 1 Apr 2021 11:52:15 +0000
(13:52 +0200)
In write_flash_image(), calling function "lseek" without checking
return value has risk. Negative return value should be handled as
an error condition.
Coverity issue: 367478
Fixes:
a05bd1b40bde
("raw/ifpga: add FPGA RSU APIs")
Signed-off-by: Wei Huang <wei.huang@intel.com>
Acked-by: Tianfei Zhang <tianfei.zhang@intel.com>
Acked-by: Rosen Xu <rosen.xu@intel.com>
drivers/raw/ifpga/base/ifpga_fme_rsu.c
patch
|
blob
|
history
diff --git
a/drivers/raw/ifpga/base/ifpga_fme_rsu.c
b/drivers/raw/ifpga/base/ifpga_fme_rsu.c
index
28198ab
..
b5e018d
100644
(file)
--- a/
drivers/raw/ifpga/base/ifpga_fme_rsu.c
+++ b/
drivers/raw/ifpga/base/ifpga_fme_rsu.c
@@
-128,7
+128,12
@@
static int write_flash_image(struct ifpga_sec_mgr *smgr, const char *image,
do {
to_transfer = (length > IFPGA_RSU_DATA_BLK_SIZE) ?
IFPGA_RSU_DATA_BLK_SIZE : length;
- lseek(fd, offset, SEEK_SET);
+ if (lseek(fd, offset, SEEK_SET) < 0) {
+ dev_err(smgr, "Failed to seek in \'%s\' [e:%s]\n",
+ image, strerror(errno));
+ ret = -EIO;
+ goto end;
+ }
read_size = read(fd, buf, to_transfer);
if (read_size < 0) {
dev_err(smgr, "Failed to read from \'%s\' [e:%s]\n",