gluster / glusterfs

Gluster Filesystem : Build your distributed storage in minutes
https://www.gluster.org
GNU General Public License v2.0
4.53k stars 1.07k forks source link

[bug:789278] Issues reported by Coverity static analysis tool #1060

Open gluster-ant opened 4 years ago

gluster-ant commented 4 years ago

URL: https://bugzilla.redhat.com/789278 Creator: ujjwala at redhat Time: 20120210T09:32:26

Description of problem: Ran coverity static analysis on Glusterfs-3.3.0qa21. Below is the summary report:

Analysis summary report:

Files analyzed : 215 Total LoC input to cov-analyze : 219946 Functions analyzed : 6428 Paths analyzed : 1189156 Defect occurrences found : 395 Total 6 ARRAY_VS_SINGLETON 4 BAD_FREE 1 CHAR_IO 38 CHECKED_RETURN 31 DEADCODE 122 FORWARD_NULL 6 MISSING_BREAK 16 NEGATIVE_RETURNS 26 NO_EFFECT 20 NULL_RETURNS 5 OVERRUN_STATIC 86 RESOURCE_LEAK 13 REVERSE_INULL 1 SIZECHECK 1 SIZEOF_MISMATCH 1 STRAY_SEMICOLON 2 UNINIT 5 UNREACHABLE 5 UNUSED_VALUE 2 USE_AFTER_FREE 4 VARARGS

Exceeded path limit of 5000 paths in 0.22% of functions (normally up to 5% of functions encounter this limitation)

Please contact me for the machine details.

Version-Release number of selected component (if applicable): Glusterfs-3.3.0qa21

How reproducible: Always

Steps to Reproduce:

  1. Install Cov static analysis.
  2. Compile the code with cov-build
  3. Run cov-analyse on the build.
  4. Run cov-commit-defects

Actual results:

Expected results:

Additional info:

gluster-ant commented 4 years ago

Time: 20140124T14:29:12 aavati at redhat commented: REVIEW: http://review.gluster.org/6778 (nfs/server: Logic error in mount tab handling.) posted (#1) for review on master by Ira Cooper (ira@redhat.com)

gluster-ant commented 4 years ago

Time: 20140124T14:56:50 aavati at redhat commented: REVIEW: http://review.gluster.org/6779 (glusterd: Free leaked error message.) posted (#1) for review on master by Ira Cooper (ira@redhat.com)

gluster-ant commented 4 years ago

Time: 20140124T15:11:57 aavati at redhat commented: REVIEW: http://review.gluster.org/6780 (glusterd: Free dup_value when error path is taken.) posted (#1) for review on master by Ira Cooper (ira@redhat.com)

gluster-ant commented 4 years ago

Time: 20140124T16:02:34 aavati at redhat commented: REVIEW: http://review.gluster.org/6782 (libgfapi: Fix pointer dereference before NULL check) posted (#1) for review on master by Jose A. Rivera (jarrpa@redhat.com)

gluster-ant commented 4 years ago

Time: 20140124T16:02:42 aavati at redhat commented: REVIEW: http://review.gluster.org/6783 (libgfapi: Remove useless call to lstat) posted (#1) for review on master by Jose A. Rivera (jarrpa@redhat.com)

gluster-ant commented 4 years ago

Time: 20140124T16:26:47 aavati at redhat commented: REVIEW: http://review.gluster.org/6784 (glusterd: Free op_errstr before it goes out of scope.) posted (#1) for review on master by Ira Cooper (ira@redhat.com)

gluster-ant commented 4 years ago

Time: 20140124T16:44:09 aavati at redhat commented: REVIEW: http://review.gluster.org/6755 (mgmt: Fix memory leak of brickid from gf_asprintf.) posted (#2) for review on master by Ira Cooper (ira@redhat.com)

gluster-ant commented 4 years ago

Time: 20140124T21:17:32 aavati at redhat commented: REVIEW: http://review.gluster.org/6783 (libgfapi: Remove useless call to lstat) posted (#2) for review on master by Jose A. Rivera (jarrpa@redhat.com)

gluster-ant commented 4 years ago

Time: 20140124T21:19:59 aavati at redhat commented: REVIEW: http://review.gluster.org/6782 (libgfapi: Fix pointer dereference before NULL check) posted (#2) for review on master by Jose A. Rivera (jarrpa@redhat.com)

gluster-ant commented 4 years ago

Time: 20140124T21:20:38 aavati at redhat commented: REVIEW: http://review.gluster.org/6783 (libgfapi: Remove useless call to lstat) posted (#3) for review on master by Jose A. Rivera (jarrpa@redhat.com)

gluster-ant commented 4 years ago

Time: 20140124T22:14:42 aavati at redhat commented: REVIEW: http://review.gluster.org/6787 (cluster/dht: goto statements may cause loop exit before memory is freed.) posted (#1) for review on master by Christopher R. Hertel (crh@redhat.com)

gluster-ant commented 4 years ago

Time: 20140125T07:46:44 aavati at redhat commented: COMMIT: http://review.gluster.org/6782 committed in master by Anand Avati (avati@redhat.com)

commit 8814fdafab377139cdf3863096234f4d5b6e543e Author: Jose A. Rivera jarrpa@redhat.com Date: Fri Jan 24 09:56:17 2014 -0600

libgfapi: Fix pointer dereference before NULL check

ctx is not checked for NULL before it is dereferenced, though the
check in "err" seems to suggest we should guard against it.

BUG: 789278
CID: 1124827

Change-Id: I6ed0b42992af5f370cce9aa2feb56811cdd54b42
Signed-off-by: Jose A. Rivera <jarrpa@redhat.com>
Reviewed-on: http://review.gluster.org/6782
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Anand Avati <avati@redhat.com>
gluster-ant commented 4 years ago

Time: 20140125T07:47:25 aavati at redhat commented: COMMIT: http://review.gluster.org/6783 committed in master by Anand Avati (avati@redhat.com)

commit c0ac21222383315b9fe84ac7c0afdf01e3ecef7b Author: Jose A. Rivera jarrpa@redhat.com Date: Fri Jan 24 10:00:02 2014 -0600

libgfapi: Remove useless call to lstat

There's no need to lstat cmd_args->volfile, since we already
check to see if fopen fails. The error message was largely the
same.

BUG: 789278
CID: 1124869

Change-Id: I10827154b32c72d2e4a1ab0d3c1e464f8af6ffee
Signed-off-by: Jose A. Rivera <jarrpa@redhat.com>
Reviewed-on: http://review.gluster.org/6783
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Anand Avati <avati@redhat.com>
gluster-ant commented 4 years ago

Time: 20140125T07:49:46 aavati at redhat commented: COMMIT: http://review.gluster.org/6755 committed in master by Anand Avati (avati@redhat.com)

commit 1968ec12e62a22fc6e55c4bcc7170d036bf28932 Author: Ira Cooper ira@samba.org Date: Tue Jan 21 22:46:59 2014 -0500

mgmt: Fix memory leak of brickid from gf_asprintf.

No GF_FREE, so one was put into the return path with proper checking.

Change-Id: Idde2803608409dcbf216062f83b7f4493946ba70
CID: 1124718
BUG: 789278
Signed-off-by: Ira Cooper <ira@samba.org>
Reviewed-on: http://review.gluster.org/6755
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Anand Avati <avati@redhat.com>
gluster-ant commented 4 years ago

Time: 20140125T07:53:26 aavati at redhat commented: COMMIT: http://review.gluster.org/6779 committed in master by Anand Avati (avati@redhat.com)

commit 580d91eb563e8d8a9eb11dbe1c285541c70dbe16 Author: Ira Cooper ira@samba.org Date: Fri Jan 24 09:54:19 2014 -0500

glusterd: Free leaked error message.

The way the previous code was written you couldn't tell if the string was
from the data area, or allocated, so we switched how the error message
is printed, and now free unconditionally.

Change-Id: Ia83cf9893acdfb5d537a61cc0bbf4aa7689e483d
CID: 1124704
BUG: 789278
Signed-off-by: Ira Cooper <ira@samba.org>
Reviewed-on: http://review.gluster.org/6779
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Anand Avati <avati@redhat.com>
gluster-ant commented 4 years ago

Time: 20140125T07:56:37 aavati at redhat commented: COMMIT: http://review.gluster.org/6778 committed in master by Anand Avati (avati@redhat.com)

commit 0f6fb218e41e3f5d2a1b76b217197b2ca7597ff7 Author: Ira Cooper ira@samba.org Date: Fri Jan 24 09:25:58 2014 -0500

nfs/server: Logic error in mount tab handling.

This error likely causes a double free and also a memory leak.

Change-Id: I299209a8b5bf8aaf487e52e9a4f00948e1d40eb5
CID: 1124703
BUG: 789278
Signed-off-by: Ira Cooper <ira@samba.org>
Reviewed-on: http://review.gluster.org/6778
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Anand Avati <avati@redhat.com>
gluster-ant commented 4 years ago

Time: 20140125T09:39:30 aavati at redhat commented: COMMIT: http://review.gluster.org/6784 committed in master by Anand Avati (avati@redhat.com)

commit d9fbebde0d2ae166c750121f807c440f6ea65478 Author: Ira Cooper ira@samba.org Date: Fri Jan 24 11:24:28 2014 -0500

glusterd: Free op_errstr before it goes out of scope.

Also removed the NULL check on path_list, as it shouldn't be needed.

Change-Id: I5b655f7b383f301afa8fc1c1c09b31e2afe47f0f
CID: 1138527
BUG: 789278
Signed-off-by: Ira Cooper <ira@samba.org>
Reviewed-on: http://review.gluster.org/6784
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Anand Avati <avati@redhat.com>
gluster-ant commented 4 years ago

Time: 20140126T19:57:15 aavati at redhat commented: REVIEW: http://review.gluster.org/6787 (cluster/dht: goto statements may cause loop exit before memory is freed.) posted (#2) for review on master by Christopher R. Hertel (crh@redhat.com)

gluster-ant commented 4 years ago

Time: 20140127T08:49:08 aavati at redhat commented: REVIEW: http://review.gluster.org/6799 (libglusterfs:Fixing Dereference NULL return value. Checking of data for NULL.) posted (#1) for review on master by Surabhi Bhalothia (surabhi.bhalothia@gmail.com)

gluster-ant commented 4 years ago

Time: 20140127T08:50:32 aavati at redhat commented: REVIEW: http://review.gluster.org/6799 (libglusterfs:Fixing Dereference NULL return value.) posted (#2) for review on master by Surabhi Bhalothia (surabhi.bhalothia@gmail.com)

gluster-ant commented 4 years ago

Time: 20140127T08:53:16 aavati at redhat commented: REVIEW: http://review.gluster.org/6799 (libglusterfs:Fixing Dereference NULL return value.) posted (#3) for review on master by Surabhi Bhalothia (surabhi.bhalothia@gmail.com)

gluster-ant commented 4 years ago

Time: 20140127T11:23:29 aavati at redhat commented: REVIEW: http://review.gluster.org/6822 (performance/io-cache: Fix dereferencing of freed pointer) posted (#1) for review on master by Poornima G (pgurusid@redhat.com)

gluster-ant commented 4 years ago

Time: 20140127T11:28:35 aavati at redhat commented: REVIEW: http://review.gluster.org/6823 (quick-read: Remove unref of a freed iobuf.) posted (#1) for review on master by Poornima G (pgurusid@redhat.com)

gluster-ant commented 4 years ago

Time: 20140127T11:29:49 aavati at redhat commented: REVIEW: http://review.gluster.org/6824 (features/qemu-block: Remove unref of freed iobuf) posted (#1) for review on master by Poornima G (pgurusid@redhat.com)

gluster-ant commented 4 years ago

Time: 20140127T21:09:46 aavati at redhat commented: REVIEW: http://review.gluster.org/6826 (cluster/dht: Abandoned memory if a call fails) posted (#1) for review on master by Christopher R. Hertel (crh@redhat.com)

gluster-ant commented 4 years ago

Time: 20140127T22:51:11 aavati at redhat commented: REVIEW: http://review.gluster.org/6827 (performance/quick-read: Allocated memory not freed when not used.) posted (#1) for review on master by Christopher R. Hertel (crh@redhat.com)

gluster-ant commented 4 years ago

Time: 20140127T23:54:54 aavati at redhat commented: REVIEW: http://review.gluster.org/6828 (features/index: Loop exit without freeing in-use memory.) posted (#1) for review on master by Christopher R. Hertel (crh@redhat.com)

gluster-ant commented 4 years ago

Time: 20140128T03:59:34 aavati at redhat commented: REVIEW: http://review.gluster.org/6829 (cli: Fixing resource leak) posted (#1) for review on master by Lalatendu Mohanty (lmohanty@redhat.com)

gluster-ant commented 4 years ago

Time: 20140128T04:02:02 aavati at redhat commented: REVIEW: http://review.gluster.org/6829 (cli: Fixing resource leak) posted (#2) for review on master by Lalatendu Mohanty (lmohanty@redhat.com)

gluster-ant commented 4 years ago

Time: 20140128T14:51:04 aavati at redhat commented: REVIEW: http://review.gluster.org/6826 (cluster/dht: Abandoned memory if a call fails) posted (#2) for review on master by Christopher R. Hertel (crh@redhat.com)

gluster-ant commented 4 years ago

Time: 20140129T10:12:55 aavati at redhat commented: REVIEW: http://review.gluster.org/6741 (quota: Fixing a possibility of GF_FREE on an array pointer) posted (#2) for review on master by Lalatendu Mohanty (lmohanty@redhat.com)

gluster-ant commented 4 years ago

Time: 20140129T11:42:55 aavati at redhat commented: REVIEW: http://review.gluster.org/6852 (gNFS: Coverity fix) posted (#1) for review on master by Santosh Pradhan (spradhan@redhat.com)

gluster-ant commented 4 years ago

Time: 20140129T12:37:05 aavati at redhat commented: REVIEW: http://review.gluster.org/6780 (glusterd: Free dup_value when error path is taken.) posted (#2) for review on master by Ira Cooper (ira@redhat.com)

gluster-ant commented 4 years ago

Time: 20140129T13:21:02 aavati at redhat commented: REVIEW: http://review.gluster.org/6852 (gNFS: Coverity fix) posted (#2) for review on master by Santosh Pradhan (spradhan@redhat.com)

gluster-ant commented 4 years ago

Time: 20140129T13:21:49 aavati at redhat commented: REVIEW: http://review.gluster.org/6852 (gNFS: Coverity fix) posted (#3) for review on master by Santosh Pradhan (spradhan@redhat.com)

gluster-ant commented 4 years ago

Time: 20140129T18:22:46 aavati at redhat commented: REVIEW: http://review.gluster.org/6741 (quota: Fixing a possibility of GF_FREE on an array pointer) posted (#3) for review on master by Lalatendu Mohanty (lmohanty@redhat.com)

gluster-ant commented 4 years ago

Time: 20140130T03:24:42 aavati at redhat commented: REVIEW: http://review.gluster.org/6739 (posix: Fix allocation of struct dirent.) posted (#2) for review on master by Ira Cooper (ira@redhat.com)

gluster-ant commented 4 years ago

Time: 20140130T03:39:50 aavati at redhat commented: COMMIT: http://review.gluster.org/6824 committed in master by Anand Avati (avati@redhat.com)

commit 410fe979b4e2492f04e9cc8949f5ef5041e1135a Author: Poornima pgurusid@redhat.com Date: Thu Jan 23 22:55:45 2014 +0000

features/qemu-block: Remove unref of freed iobuf

Change-Id: I507a6504b379eef54be77b54d6e2beee63975ebf
BUG: 789278
Signed-off-by: Poornima <pgurusid@redhat.com>
Reviewed-on: http://review.gluster.org/6824
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Raghavendra Talur <rtalur@redhat.com>
Reviewed-by: Anand Avati <avati@redhat.com>
gluster-ant commented 4 years ago

Time: 20140130T04:16:37 aavati at redhat commented: REVIEW: http://review.gluster.org/6739 (posix: Fix allocation of struct dirent.) posted (#3) for review on master by Ira Cooper (ira@redhat.com)

gluster-ant commented 4 years ago

Time: 20140130T11:16:22 aavati at redhat commented: REVIEW: http://review.gluster.org/6799 (libglusterfs:Fixing Dereference NULL return value.) posted (#4) for review on master by Surabhi Bhalothia (surabhi.bhalothia@gmail.com)

gluster-ant commented 4 years ago

Time: 20140130T12:44:08 aavati at redhat commented: REVIEW: http://review.gluster.org/6799 (libglusterfs:Fixing Dereference NULL return value.) posted (#5) for review on master by Surabhi Bhalothia (surabhi.bhalothia@gmail.com)

gluster-ant commented 4 years ago

Time: 20140130T12:49:27 aavati at redhat commented: REVIEW: http://review.gluster.org/6868 (Fix for 'use after free' errors reported by coverity.) posted (#1) for review on master by Poornima G (pgurusid@redhat.com)

gluster-ant commented 4 years ago

Time: 20140130T12:55:55 aavati at redhat commented: REVIEW: http://review.gluster.org/6869 (performance/io-cache: Fix for the bugs reported by coverity) posted (#1) for review on master by Poornima G (pgurusid@redhat.com)

gluster-ant commented 4 years ago

Time: 20140130T14:24:25 aavati at redhat commented: REVIEW: http://review.gluster.org/6870 (changelog: Restrict length of unix socket files to UNIX_PATH_MAX.) posted (#1) for review on master by Raghavendra Talur (rtalur@redhat.com)

gluster-ant commented 4 years ago

Time: 20140131T02:26:03 aavati at redhat commented: REVIEW: http://review.gluster.org/6870 (changelog: Restrict length of unix socket files to UNIX_PATH_MAX.) posted (#2) for review on master by Raghavendra Talur (rtalur@redhat.com)

gluster-ant commented 4 years ago

Time: 20140131T08:22:16 aavati at redhat commented: REVIEW: http://review.gluster.org/6881 (mgmt/glusterd: Fix double free.) posted (#1) for review on master by Poornima G (pgurusid@redhat.com)

gluster-ant commented 4 years ago

Time: 20140131T13:09:40 aavati at redhat commented: REVIEW: http://review.gluster.org/6826 (cluster/dht: Abandoned memory if a call fails) posted (#3) for review on master by Christopher R. Hertel (crh@redhat.com)

gluster-ant commented 4 years ago

Time: 20140131T13:27:46 aavati at redhat commented: REVIEW: http://review.gluster.org/6828 (features/index: Loop exit without freeing in-use memory.) posted (#2) for review on master by Christopher R. Hertel (crh@redhat.com)

gluster-ant commented 4 years ago

Time: 20140131T13:47:26 aavati at redhat commented: REVIEW: http://review.gluster.org/6828 (features/index: Loop exit without freeing in-use memory.) posted (#3) for review on master by Christopher R. Hertel (crh@redhat.com)

gluster-ant commented 4 years ago

Time: 20140131T17:01:39 aavati at redhat commented: REVIEW: http://review.gluster.org/6826 (cluster/dht: Abandoned memory if a call fails) posted (#4) for review on master by Christopher R. Hertel (crh@redhat.com)