glusterfs icon indicating copy to clipboard operation
glusterfs copied to clipboard

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

Open gluster-ant opened this issue 4 years ago • 899 comments

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 avatar Mar 12 '20 14:03 gluster-ant

Time: 20120423T21:53:05 aavati at redhat commented: CHANGE: http://review.gluster.com/3145 (core: coverity issues fixed) merged in master by Anand Avati ([email protected])

gluster-ant avatar Mar 12 '20 14:03 gluster-ant

Time: 20120503T08:59:44 amarts at redhat commented: Analysis summary report:

Files analyzed : 227 Total LoC input to cov-analyze : 234721 Functions analyzed : 6735 Paths analyzed : 1201804 Defect occurrences found : 345 Total 4 ARRAY_VS_SINGLETON (HIGH) 1 CHAR_IO 38 CHECKED_RETURN 48 DEADCODE 106 FORWARD_NULL 5 MISSING_BREAK 7 NEGATIVE_RETURNS 22 NO_EFFECT 6 NULL_RETURNS 3 OVERRUN_STATIC (HIGH) 74 RESOURCE_LEAK (HIGH) 13 REVERSE_INULL 2 STRAY_SEMICOLON 1 UNINIT (HIGH) 4 UNREACHABLE 5 UNUSED_VALUE 6 VARARGS

Shows that most of the HIGH issues compared to earlier codebase are fixed now. Other than 'RESOURCE LEAK', we have most of the HIGH issues as false positive.

gluster-ant avatar Mar 12 '20 14:03 gluster-ant

Time: 20120504T07:06:38 amarts at redhat commented: http://review.gluster.com/3265 && http://review.gluster.com/3266 sent, but looking at it, its better to take this bug as a ERRATA fix, and not a release blocker, because the changes involved to fix all of these are significant code change (and touches most part of the code), so QA will become very serious problem.

Taking it off the 'beta' blocker list.

gluster-ant avatar Mar 12 '20 14:03 gluster-ant

Time: 20120509T07:41:30 aavati at redhat commented: CHANGE: http://review.gluster.com/3266 (geo-replication: coverity resource leak fixes) merged in master by Anand Avati ([email protected])

gluster-ant avatar Mar 12 '20 14:03 gluster-ant

Time: 20120518T07:45:23 aavati at redhat commented: CHANGE: http://review.gluster.com/3345 (geo-rep / gsyncd.c: fix coverity fix) merged in master by Vijay Bellur ([email protected])

gluster-ant avatar Mar 12 '20 14:03 gluster-ant

Time: 20120606T12:40:30 amarts at redhat commented: Keep this open till we fix all the valid coverity warnings.

gluster-ant avatar Mar 12 '20 14:03 gluster-ant

Time: 20120711T10:18:57 amarts at redhat commented: releng-test1.englab.brq.redhat.com/covscan/task/757/

gluster-ant avatar Mar 12 '20 14:03 gluster-ant

Time: 20120712T02:11:29 vbellur at redhat commented: CHANGE: http://review.gluster.com/3589 (xlator options: remove overwritten data-self-heal initializer) merged in master by Anand Avati ([email protected])

gluster-ant avatar Mar 12 '20 14:03 gluster-ant

Time: 20120712T02:13:17 vbellur at redhat commented: CHANGE: http://review.gluster.com/3594 (nfs-common: don't let 0-length path cause buf[-1] access) merged in master by Anand Avati ([email protected])

gluster-ant avatar Mar 12 '20 14:03 gluster-ant

Time: 20120712T02:13:40 vbellur at redhat commented: CHANGE: http://review.gluster.com/3591 (glusterd: avoid buffer overrun for over-long volname) merged in master by Anand Avati ([email protected])

gluster-ant avatar Mar 12 '20 14:03 gluster-ant

Time: 20120712T02:14:30 vbellur at redhat commented: CHANGE: http://review.gluster.com/3596 (gsyncd: don't let a bogus config file make us read/write buf[-1]) merged in master by Anand Avati ([email protected])

gluster-ant avatar Mar 12 '20 14:03 gluster-ant

Time: 20120712T02:15:00 vbellur at redhat commented: CHANGE: http://review.gluster.com/3603 (read_conf: don't let a corrupt config file cause invalid line[-1] reference) merged in master by Anand Avati ([email protected])

gluster-ant avatar Mar 12 '20 14:03 gluster-ant

Time: 20120712T02:17:27 vbellur at redhat commented: CHANGE: http://review.gluster.com/3646 (cli: print_brick_status: don't smash stack) merged in master by Anand Avati ([email protected])

gluster-ant avatar Mar 12 '20 14:03 gluster-ant

Time: 20120712T02:18:09 vbellur at redhat commented: CHANGE: http://review.gluster.com/3606 (cli: cli_cmd_get_confirmation: don't reference answer[-1] for NUL input) merged in master by Anand Avati ([email protected])

gluster-ant avatar Mar 12 '20 14:03 gluster-ant

Time: 20120712T02:35:00 vbellur at redhat commented: CHANGE: http://review.gluster.com/3648 (glusterfsd: don't ignore tmpfile write failure (2x)) merged in master by Anand Avati ([email protected])

gluster-ant avatar Mar 12 '20 14:03 gluster-ant

Time: 20120712T07:27:30 vbellur at redhat commented: CHANGE: http://review.gluster.com/3647 (geo-rep: don't let unexpected status provoke undefined behavior) merged in master by Anand Avati ([email protected])

gluster-ant avatar Mar 12 '20 14:03 gluster-ant

Time: 20120713T21:05:36 vbellur at redhat commented: CHANGE: http://review.gluster.com/3669 (gsyncd: don't dereference NULL upon failed realloc) merged in master by Anand Avati ([email protected])

gluster-ant avatar Mar 12 '20 14:03 gluster-ant

Time: 20120713T21:06:42 vbellur at redhat commented: CHANGE: http://review.gluster.com/3670 (cli-xml-output.c: avoid NULL-deref upon OOM) merged in master by Anand Avati ([email protected])

gluster-ant avatar Mar 12 '20 14:03 gluster-ant

Time: 20121221T11:16:39 amarts at redhat commented: considering this bug will be open forever (ie, coverity issues may be present in any versions, and will be valid for all versions), reducing the priority, and marking it as ON_DEV (to separate out from ASSIGNED state).

gluster-ant avatar Mar 12 '20 14:03 gluster-ant

Time: 20140113T12:02:44 lmohanty at redhat commented: I was not aware of this bug, so have sent some patches as RFC to fix Coverity issues. Just to keep a track, I am putting the links of the patches here.

http://review.gluster.org/#/c/6626/ http://review.gluster.org/#/c/6667/ http://review.gluster.org/#/c/6313/ http://review.gluster.org/#/c/6645/

gluster-ant avatar Mar 12 '20 14:03 gluster-ant

Time: 20140114T14:03:12 aavati at redhat commented: REVIEW: http://review.gluster.org/6697 (libgfapi: Fixing possible dereferencing of null pointer "glfd" Fix: Putting a check so that pointer derefrence does not happen when "gfld" is null) posted (#1) for review on master by Lalatendu Mohanty ([email protected])

gluster-ant avatar Mar 12 '20 14:03 gluster-ant

Time: 20140114T18:01:07 aavati at redhat commented: REVIEW: http://review.gluster.org/6700 (geo-rep: Fixing null pointer dereference of "op_value") posted (#1) for review on master by Lalatendu Mohanty ([email protected])

gluster-ant avatar Mar 12 '20 14:03 gluster-ant

Time: 20140114T18:57:17 aavati at redhat commented: REVIEW: http://review.gluster.org/6701 (core: Fixing Coverity issue "Use of uninitialized scalar variable") posted (#1) for review on master by Lalatendu Mohanty ([email protected])

gluster-ant avatar Mar 12 '20 14:03 gluster-ant

Time: 20140115T18:09:07 aavati at redhat commented: COMMIT: http://review.gluster.org/6700 committed in master by Vijay Bellur ([email protected])

commit f3e227d525ee04a3ea0196f7a15aa9b1a8f8cae1 Author: Lalatendu Mohanty [email protected] Date: Tue Jan 14 23:24:50 2014 +0530

geo-rep: Fixing null pointer dereference of "op_value"

Change-Id: Id39743eaa5a52cc7fd4e2a1378a23384f5ef1fed
BUG: 789278
Signed-off-by: Lalatendu Mohanty <[email protected]>
Reviewed-on: http://review.gluster.org/6700
Reviewed-by: Avra Sengupta <[email protected]>
Tested-by: Avra Sengupta <[email protected]>

gluster-ant avatar Mar 12 '20 14:03 gluster-ant

Time: 20140115T21:50:52 aavati at redhat commented: REVIEW: http://review.gluster.org/6697 (libgfapi: Fixing possible dereferencing of null pointer "glfd") posted (#2) for review on master by Anand Avati ([email protected])

gluster-ant avatar Mar 12 '20 14:03 gluster-ant

Time: 20140116T08:59:11 aavati at redhat commented: COMMIT: http://review.gluster.org/6697 committed in master by Vijay Bellur ([email protected])

commit c9008fe6a1a4d9c25c4b11804bcc9e5b6edf9bec Author: Lalatendu Mohanty [email protected] Date: Tue Jan 14 12:35:54 2014 +0530

libgfapi: Fixing possible dereferencing of null pointer "glfd"

Fix: Putting a check so that pointer derefrence does not happen
when "gfld" is null

Change-Id: I281b10be445bbeec3a2728fc139d5ac94372e5b6
BUG: 789278
Signed-off-by: Lalatendu Mohanty <[email protected]>
Reviewed-on: http://review.gluster.org/6697
Tested-by: Gluster Build System <[email protected]>
Reviewed-by: Shyamsundar Ranganathan <[email protected]>
Reviewed-by: Vijay Bellur <[email protected]>

gluster-ant avatar Mar 12 '20 14:03 gluster-ant

Time: 20140116T14:15:00 aavati at redhat commented: REVIEW: http://review.gluster.org/6701 (core: Fixing Coverity issue "Use of uninitialized scalar variable") posted (#2) for review on master by Lalatendu Mohanty ([email protected])

gluster-ant avatar Mar 12 '20 14:03 gluster-ant

Time: 20140116T15:10:49 aavati at redhat commented: REVIEW: http://review.gluster.org/6701 (core: Fixing Coverity issue "Use of uninitialized scalar variable") posted (#3) for review on master by Lalatendu Mohanty ([email protected])

gluster-ant avatar Mar 12 '20 14:03 gluster-ant

Time: 20140116T15:19:43 aavati at redhat commented: REVIEW: http://review.gluster.org/6701 (core: Coverity issue "Use of uninitialized scalar variable") posted (#4) for review on master by Lalatendu Mohanty ([email protected])

gluster-ant avatar Mar 12 '20 14:03 gluster-ant

Time: 20140118T16:47:31 aavati at redhat commented: COMMIT: http://review.gluster.org/6701 committed in master by Vijay Bellur ([email protected])

commit 1ffc3ac9639e25c91ac26488b648d5523becb08e Author: Lalatendu Mohanty [email protected] Date: Tue Jan 14 23:50:51 2014 +0530

core: Coverity issue "Use of uninitialized scalar variable"

Issue:
1. In "unlink (export_path)" "export_path" might contain an arbitrary value left from earlier
 computations.
2. In "(msg[0] != '\0')"  msg might contain an arbitrary value

Change-Id: Icca8f557fd6b5e046dff1d5a84a72061975868d0
BUG: 789278
Signed-off-by: Lalatendu Mohanty <[email protected]>
Reviewed-on: http://review.gluster.org/6701
Tested-by: Gluster Build System <[email protected]>
Reviewed-by: Vijay Bellur <[email protected]>

gluster-ant avatar Mar 12 '20 14:03 gluster-ant