Skip to content

Commit

Permalink
libndctl: fix an unhandled return in ndctl_bus_poll_scrub_completion()
Browse files Browse the repository at this point in the history
Static analysis warns that we were not checking the return value from
the call to open(2) in ndctl_bus_poll_scrub_completion(). Add the
checking and error out for this case.

Cc: Dan Williams <[email protected]>
Reviewed-by: Dan Williams <[email protected]>
Signed-off-by: Vishal Verma <[email protected]>
  • Loading branch information
stellarhopper committed May 10, 2019
1 parent 1265cd7 commit df989d9
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions ndctl/lib/libndctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -1306,6 +1306,8 @@ NDCTL_EXPORT int ndctl_bus_poll_scrub_completion(struct ndctl_bus *bus,
int fd = 0, rc;

fd = open(bus->scrub_path, O_RDONLY|O_CLOEXEC);
if (fd < 0)
return -errno;
memset(&fds, 0, sizeof(fds));
fds.fd = fd;
for (;;) {
Expand Down

0 comments on commit df989d9

Please sign in to comment.