You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

99 lines
3.0 KiB

  1. From ad8c3353b8e482575ff2208182290cf35b624dde Mon Sep 17 00:00:00 2001
  2. From: Chris Leech <cleech@redhat.com>
  3. Date: Wed, 5 Jun 2019 09:08:39 -0700
  4. Subject: [PATCH 1/1] Coverity scan fixes
  5. ---
  6. iscsiuio/src/unix/libs/qedi.c | 2 +-
  7. iscsiuio/src/unix/main.c | 3 +++
  8. libopeniscsiusr/idbm.c | 11 +++++------
  9. usr/idbm.c | 10 ++++------
  10. usr/initiator.c | 2 +-
  11. usr/iscsid.c | 2 +-
  12. 6 files changed, 15 insertions(+), 15 deletions(-)
  13. --- a/iscsiuio/src/unix/libs/qedi.c
  14. +++ b/iscsiuio/src/unix/libs/qedi.c
  15. @@ -1030,7 +1030,7 @@ static int qedi_read(nic_t *nic, packet_
  16. LOG_DEBUG(PFX "%s:hw_prod %d bd_prod %d, rx_pkt_idx %d, rxlen %d",
  17. nic->log_name, hw_prod, bd_prod, rx_bd->rx_pkt_index, len);
  18. - LOG_DEBUG(PFX "%s: sw_con %d bd_cons %d num BD %d",
  19. + LOG_DEBUG(PFX "%s: sw_con %d bd_cons %d num BD %lu",
  20. nic->log_name, sw_cons, bd_cons, QEDI_NUM_RX_BD);
  21. if (bd_cons != bd_prod) {
  22. --- a/iscsiuio/src/unix/main.c
  23. +++ b/iscsiuio/src/unix/main.c
  24. @@ -391,6 +391,9 @@ int main(int argc, char *argv[])
  25. sigaddset(&set, SIGTERM);
  26. sigaddset(&set, SIGUSR1);
  27. rc = pthread_sigmask(SIG_SETMASK, &set, NULL);
  28. + if (rc != 0) {
  29. + LOG_ERR("Failed to set thread signal mask");
  30. + }
  31. /* Spin off the signal handling thread */
  32. pthread_attr_init(&attr);
  33. --- a/libopeniscsiusr/idbm.c
  34. +++ b/libopeniscsiusr/idbm.c
  35. @@ -321,12 +321,11 @@ int _idbm_lock(struct iscsi_context *ctx
  36. return 0;
  37. }
  38. - if (access(LOCK_DIR, F_OK) != 0) {
  39. - if (mkdir(LOCK_DIR, 0660) != 0) {
  40. - _error(ctx, "Could not open %s: %d %s", LOCK_DIR, errno,
  41. - _strerror(errno, strerr_buff));
  42. - return LIBISCSI_ERR_IDBM;
  43. - }
  44. + if (((mkdir(LOCK_DIR, 0660) != 0) && (errno != EEXIST)) ||
  45. + (access(LOCK_DIR, F_OK) != 0)) {
  46. + _error(ctx, "Could not open %s: %d %s", LOCK_DIR, errno,
  47. + _strerror(errno, strerr_buff));
  48. + return LIBISCSI_ERR_IDBM;
  49. }
  50. fd = open(LOCK_FILE, O_RDWR | O_CREAT, 0666);
  51. --- a/usr/idbm.c
  52. +++ b/usr/idbm.c
  53. @@ -1439,12 +1439,10 @@ int idbm_lock(void)
  54. return 0;
  55. }
  56. - if (access(LOCK_DIR, F_OK) != 0) {
  57. - if (mkdir(LOCK_DIR, 0660) != 0) {
  58. - log_error("Could not open %s: %s", LOCK_DIR,
  59. - strerror(errno));
  60. - return ISCSI_ERR_IDBM;
  61. - }
  62. + if (((mkdir(LOCK_DIR, 0660) != 0) && (errno != EEXIST)) ||
  63. + (access(LOCK_DIR, F_OK) != 0)) {
  64. + log_error("Could not open %s: %s", LOCK_DIR, strerror(errno));
  65. + return ISCSI_ERR_IDBM;
  66. }
  67. fd = open(LOCK_FILE, O_RDWR | O_CREAT, 0666);
  68. --- a/usr/iscsid.c
  69. +++ b/usr/iscsid.c
  70. @@ -495,8 +495,8 @@ int main(int argc, char *argv[])
  71. log_close(log_pid);
  72. exit(ISCSI_ERR);
  73. }
  74. + close(fd);
  75. }
  76. - close(fd);
  77. if ((control_fd = ipc->ctldev_open()) < 0) {
  78. log_close(log_pid);
  79. --- a/usr/initiator.c
  80. +++ b/usr/initiator.c
  81. @@ -580,7 +580,7 @@ __session_conn_reopen(iscsi_conn_t *conn
  82. int redirected)
  83. {
  84. iscsi_session_t *session = conn->session;
  85. - uint32_t delay;
  86. + uint32_t delay = 0;
  87. log_debug(1, "re-opening session %d (reopen_cnt %d)", session->id,
  88. session->reopen_cnt);