2021-06-15 04:22:38 +00:00
|
|
|
From c455d7ff3a2fa37cdd5b43616db975aef336a007 Mon Sep 17 00:00:00 2001
|
2020-11-05 10:08:40 +00:00
|
|
|
From: Chris Leech <cleech@redhat.com>
|
|
|
|
Date: Wed, 5 Jun 2019 09:08:39 -0700
|
2021-06-15 04:22:38 +00:00
|
|
|
Subject: [PATCH 1/1] Coverity scan fixes
|
2020-11-05 10:08:40 +00:00
|
|
|
|
|
|
|
---
|
|
|
|
iscsiuio/src/unix/libs/qedi.c | 2 +-
|
|
|
|
iscsiuio/src/unix/main.c | 3 +++
|
|
|
|
libopeniscsiusr/idbm.c | 11 +++++------
|
|
|
|
usr/idbm.c | 10 ++++------
|
|
|
|
usr/iscsid.c | 2 +-
|
|
|
|
5 files changed, 14 insertions(+), 14 deletions(-)
|
|
|
|
|
|
|
|
diff --git a/iscsiuio/src/unix/libs/qedi.c b/iscsiuio/src/unix/libs/qedi.c
|
2021-06-15 04:22:38 +00:00
|
|
|
index 1af8d1b..9a814c6 100644
|
2020-11-05 10:08:40 +00:00
|
|
|
--- a/iscsiuio/src/unix/libs/qedi.c
|
|
|
|
+++ b/iscsiuio/src/unix/libs/qedi.c
|
2021-06-15 04:22:38 +00:00
|
|
|
@@ -1030,7 +1030,7 @@ static int qedi_read(nic_t *nic, packet_t *pkt)
|
2020-11-05 10:08:40 +00:00
|
|
|
|
|
|
|
LOG_DEBUG(PFX "%s:hw_prod %d bd_prod %d, rx_pkt_idx %d, rxlen %d",
|
|
|
|
nic->log_name, hw_prod, bd_prod, rx_bd->rx_pkt_index, len);
|
|
|
|
- LOG_DEBUG(PFX "%s: sw_con %d bd_cons %d num BD %d",
|
|
|
|
+ LOG_DEBUG(PFX "%s: sw_con %d bd_cons %d num BD %lu",
|
|
|
|
nic->log_name, sw_cons, bd_cons, QEDI_NUM_RX_BD);
|
|
|
|
|
|
|
|
if (bd_cons != bd_prod) {
|
|
|
|
diff --git a/iscsiuio/src/unix/main.c b/iscsiuio/src/unix/main.c
|
|
|
|
index 0c9ad49..f83f305 100644
|
|
|
|
--- a/iscsiuio/src/unix/main.c
|
|
|
|
+++ b/iscsiuio/src/unix/main.c
|
|
|
|
@@ -391,6 +391,9 @@ int main(int argc, char *argv[])
|
|
|
|
sigaddset(&set, SIGTERM);
|
|
|
|
sigaddset(&set, SIGUSR1);
|
|
|
|
rc = pthread_sigmask(SIG_SETMASK, &set, NULL);
|
|
|
|
+ if (rc != 0) {
|
|
|
|
+ LOG_ERR("Failed to set thread signal mask");
|
|
|
|
+ }
|
|
|
|
|
|
|
|
/* Spin off the signal handling thread */
|
|
|
|
pthread_attr_init(&attr);
|
|
|
|
diff --git a/libopeniscsiusr/idbm.c b/libopeniscsiusr/idbm.c
|
2021-06-15 04:22:38 +00:00
|
|
|
index 0910c63..6213e62 100644
|
2020-11-05 10:08:40 +00:00
|
|
|
--- a/libopeniscsiusr/idbm.c
|
|
|
|
+++ b/libopeniscsiusr/idbm.c
|
|
|
|
@@ -321,12 +321,11 @@ int _idbm_lock(struct iscsi_context *ctx)
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
- if (access(LOCK_DIR, F_OK) != 0) {
|
2021-06-15 04:22:38 +00:00
|
|
|
- if (mkdir(LOCK_DIR, 0770) != 0) {
|
2020-11-05 10:08:40 +00:00
|
|
|
- _error(ctx, "Could not open %s: %d %s", LOCK_DIR, errno,
|
|
|
|
- _strerror(errno, strerr_buff));
|
|
|
|
- return LIBISCSI_ERR_IDBM;
|
|
|
|
- }
|
2021-06-15 04:22:38 +00:00
|
|
|
+ if (((mkdir(LOCK_DIR, 0770) != 0) && (errno != EEXIST)) ||
|
2020-11-05 10:08:40 +00:00
|
|
|
+ (access(LOCK_DIR, F_OK) != 0)) {
|
|
|
|
+ _error(ctx, "Could not open %s: %d %s", LOCK_DIR, errno,
|
|
|
|
+ _strerror(errno, strerr_buff));
|
|
|
|
+ return LIBISCSI_ERR_IDBM;
|
|
|
|
}
|
|
|
|
|
|
|
|
fd = open(LOCK_FILE, O_RDWR | O_CREAT, 0666);
|
|
|
|
diff --git a/usr/idbm.c b/usr/idbm.c
|
2021-06-15 04:22:38 +00:00
|
|
|
index b33ae42..1ac0b73 100644
|
2020-11-05 10:08:40 +00:00
|
|
|
--- a/usr/idbm.c
|
|
|
|
+++ b/usr/idbm.c
|
2021-06-15 04:22:38 +00:00
|
|
|
@@ -1461,12 +1461,10 @@ int idbm_lock(void)
|
2020-11-05 10:08:40 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
- if (access(LOCK_DIR, F_OK) != 0) {
|
2021-06-15 04:22:38 +00:00
|
|
|
- if (mkdir(LOCK_DIR, 0770) != 0) {
|
2020-11-05 10:08:40 +00:00
|
|
|
- log_error("Could not open %s: %s", LOCK_DIR,
|
|
|
|
- strerror(errno));
|
|
|
|
- return ISCSI_ERR_IDBM;
|
|
|
|
- }
|
2021-06-15 04:22:38 +00:00
|
|
|
+ if (((mkdir(LOCK_DIR, 0770) != 0) && (errno != EEXIST)) ||
|
2020-11-05 10:08:40 +00:00
|
|
|
+ (access(LOCK_DIR, F_OK) != 0)) {
|
|
|
|
+ log_error("Could not open %s: %s", LOCK_DIR, strerror(errno));
|
|
|
|
+ return ISCSI_ERR_IDBM;
|
|
|
|
}
|
|
|
|
|
|
|
|
fd = open(LOCK_FILE, O_RDWR | O_CREAT, 0666);
|
|
|
|
diff --git a/usr/iscsid.c b/usr/iscsid.c
|
2021-06-15 04:22:38 +00:00
|
|
|
index dc54fec..fde8894 100644
|
2020-11-05 10:08:40 +00:00
|
|
|
--- a/usr/iscsid.c
|
|
|
|
+++ b/usr/iscsid.c
|
2021-06-15 04:22:38 +00:00
|
|
|
@@ -510,8 +510,8 @@ int main(int argc, char *argv[])
|
2020-11-05 10:08:40 +00:00
|
|
|
log_close(log_pid);
|
|
|
|
exit(ISCSI_ERR);
|
|
|
|
}
|
|
|
|
+ close(fd);
|
|
|
|
}
|
|
|
|
- close(fd);
|
|
|
|
|
|
|
|
if ((control_fd = ipc->ctldev_open()) < 0) {
|
|
|
|
log_close(log_pid);
|
|
|
|
--
|
2021-06-15 04:22:38 +00:00
|
|
|
2.31.1
|
2020-11-05 10:08:40 +00:00
|
|
|
|