Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Coverity and SCA fixes #7784

Merged
merged 25 commits into from Nov 11, 2016
Merged

Coverity and SCA fixes #7784

merged 25 commits into from Nov 11, 2016

Conversation

dalgaaf
Copy link
Contributor

@dalgaaf dalgaaf commented Feb 24, 2016

Build fix:

  • Wsign-compare
  • fix missing options in some man pages

SCA:

  • init member vars in ctor
  • remove not needed vars
  • fix goto mark

Coverity:

  • UNINIT_CTOR
  • TAINTED_SCALAR
  • OVERRUN

@dalgaaf dalgaaf changed the title Coverity and SCA fixes DNM: Coverity and SCA fixes Feb 25, 2016
@tchaikov
Copy link
Contributor

tchaikov commented Mar 1, 2016

@dalgaaf why did you add the DNM prefix?

@dalgaaf dalgaaf force-pushed the wip-da-SCA-20160219 branch 2 times, most recently from eb45f0a to 9401b33 Compare March 1, 2016 10:53
@gregsfortytwo
Copy link
Member

FS/MDS patches look good.

@dalgaaf dalgaaf force-pushed the wip-da-SCA-20160219 branch 2 times, most recently from 2fdab0c to 265cdaf Compare March 8, 2016 15:53
@dalgaaf
Copy link
Contributor Author

dalgaaf commented Mar 8, 2016

@tchaikov: added the DNM because the build check failed and I'm not completely sure if this is caused by the commits.

@dalgaaf dalgaaf changed the title DNM: Coverity and SCA fixes Coverity and SCA fixes Mar 8, 2016
@tchaikov
Copy link
Contributor

tchaikov commented Mar 9, 2016

quite a few of the cli tests failed, in the cases of failures, the cli tools printed nothing.

src/test/cli/osdmaptool/create-racks.t: failed

@dalgaaf
Copy link
Contributor Author

dalgaaf commented Mar 10, 2016

@tchaikov: should work now, fixed the ConfUtils.cc patch

@dalgaaf
Copy link
Contributor Author

dalgaaf commented Mar 10, 2016

rebased to master

@dalgaaf dalgaaf force-pushed the wip-da-SCA-20160219 branch 2 times, most recently from 9ee8f03 to 236421c Compare March 15, 2016 18:49
@dalgaaf
Copy link
Contributor Author

dalgaaf commented Mar 15, 2016

Rebased and dropped one patch that was committed by someone else. Please review!

@dalgaaf dalgaaf force-pushed the wip-da-SCA-20160219 branch 2 times, most recently from 2fe6216 to 0613ad1 Compare March 20, 2016 18:47
@dalgaaf
Copy link
Contributor Author

dalgaaf commented Mar 20, 2016

rebased again ... would be nice if we can get this patch series merged

ret = rgw_lookup(fs, fs->root_fh, get<0>(fid).c_str(), &rgw_fh,
0 /* flags */);
ASSERT_EQ(ret, 0);
ASSERT_EQ(0, rgw_lookup(fs, fs->root_fh, get<0>(fid).c_str(), &rgw_fh, 0 /* flags */));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe wrap this line so it does not exceed 80 chars?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not that I want to be nit-picking, but the source has at least ~17000 lines of code that exceed the 80 char limit. Is this something we start to enforce now? But I will change it anyway if this is what you want.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i agreed. we do not enforce this. but per https://github.com/ceph/ceph/blob/master/CodingStyle, we suggest using https://google.github.io/styleguide/cppguide.html as a baseline, which in turn puts this limit. see https://google.github.io/styleguide/cppguide.html#Line_Length

@tchaikov
Copy link
Contributor

lgtm modulo some nits.

Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
Fixup for:

CID 1351687 (#1 of 1): Uninitialized scalar variable (UNINIT)
 var_decl: Declaring variable lock_type without initializer
 uninit_use: Using uninitialized value lock_type.

Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
Fix for:

CID 1313448 (#1 of 1): Uninitialized scalar variable (UNINIT)
 uninit_use: Using uninitialized value want[i + this->k]

Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
Fix for:

CID 1254379 (#1 of 1): Uninitialized scalar variable (UNINIT)
 uninit_use_in_call: Using uninitialized value c when calling write.

Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
Fix for:

CID 1128394 (#1 of 1): Integer overflowed argument (INTEGER_OVERFLOW)
 overflow: Add operation overflows on operands line_len and 1UL.
 overflow_assign: Assigning overflowed or truncated value (or a value
  computed from an overflowed or a truncated value) to rem.
 overflow_sink: Overflowed or truncated value (or a value computed from an
  overflowed or truncated value) rem used as critical argument to function.

Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
Add missing option to the correct section to fix build
warnings. Resort the 'Options' section to alphabetical order.

Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
Fix for:

CID 1353420 (#1 of 1): Uninitialized pointer field (UNINIT_CTOR)
 uninit_member: Non-static class member cct is not initialized in
  this constructor nor in any functions that it calls.
 uninit_member: Non-static class member store is not initialized in
  this constructor nor in any functions that it calls.
CID 1353421 (#1 of 1): Uninitialized pointer field (UNINIT_CTOR)
 uninit_member: Non-static class member cct is not initialized in
  this constructor nor in any functions that it calls.
 uninit_member: Non-static class member store is not initialized
  in this constructor nor in any functions that it calls.
CID 1353427 (#1 of 1): Uninitialized pointer field (UNINIT_CTOR)
 uninit_member: Non-static class member cct is not initialized in
  this constructor nor in any functions that it calls.
 uninit_member: Non-static class member store is not initialized
  in this constructor nor in any functions that it calls.

Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
Fix for:

CID 1297862 (#1 of 1): Out-of-bounds access (OVERRUN)
 alloc_strlen: Allocating insufficient memory for the terminating
  null of the string.

Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
CID 1351705 (#1 of 1): Uninitialized scalar field (UNINIT_CTOR)
 uninit_member: Non-static class member daily_loadavg is not
  initialized in this constructor nor in any functions that it calls.

Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
CID 1351707 (#1 of 1): Uninitialized scalar field (UNINIT_CTOR)
 uninit_member: Non-static class member offset is not initialized
  in this constructor nor in any functions that it calls.
 uninit_member: Non-static class member length is not initialized
  in this constructor nor in any functions that it calls.

Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
Fix for:

CID 1351706 (#1 of 1): Uninitialized scalar field (UNINIT_CTOR)
 uninit_member: Non-static class member nid_last is not initialized
  in this constructor nor in any functions that it calls.

Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
CID 1351708 (#1 of 1): Uninitialized scalar field (UNINIT_CTOR)
 uninit_member: Non-static class member code is not initialized
  in this constructor nor in any functions that it calls.

Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
Fix for:

CID 1353422 (#1 of 1): Uninitialized pointer field (UNINIT_CTOR)
 uninit_member: Non-static class member cct is not initialized in this
  constructor nor in any functions that it calls.
 uninit_member: Non-static class member store is not initialized in
  this constructor nor in any functions that it calls.
CID 1353426 (#1 of 1): Uninitialized pointer field (UNINIT_CTOR)
 uninit_member: Non-static class member cct is not initialized in this
  constructor nor in any functions that it calls.
 uninit_member: Non-static class member store is not initialized in
  this constructor nor in any functions that it calls.

Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
Fix for:

CID 1351734 (#1 of 1): Uninitialized scalar field (UNINIT_CTOR)
 uninit_member: Non-static class member result is not initialized
  in this constructor nor in any functions that it calls.

Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
Fix for:

CID 717232 (#1 of 1): Uninitialized scalar field (UNINIT_CTOR)
 uninit_member: Non-static class member cap_id is not initialized
  in this constructor nor in any functions that it calls.
 uninit_member: Non-static class member wanted is not initialized
  in this constructor nor in any functions that it calls.
 uninit_member: Non-static class member issued is not initialized
  in this constructor nor in any functions that it calls.
 uninit_member: Non-static class member pending is not initialized
  in this constructor nor in any functions that it calls.
 uninit_member: Non-static class member seq is not initialized in
  this constructor nor in any functions that it calls.
 uninit_member: Non-static class member mseq is not initialized
  in this constructor nor in any functions that it calls.

Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
Fix for:

CID 1351689 (#1 of 1): Uninitialized scalar field (UNINIT_CTOR)
 uninit_member: Non-static class member total_size is not initialized
  in this constructor nor in any functions that it calls.

Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
Fix for:

CID 1313449 (#1 of 1): Uninitialized scalar field (UNINIT_CTOR)
 uninit_member: Non-static class member force_init is not initialized
  in this constructor nor in any functions that it calls.

Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
Fix for:

CID 1274314 (#1 of 1): Uninitialized scalar field (UNINIT_CTOR)
 uninit_member: Non-static class member m_header_crc is not initialized
  in this constructor nor in any functions that it calls.

Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
Fix for:

CID 1138591 (#1 of 1): Uninitialized scalar field (UNINIT_CTOR)
 uninit_member: Non-static class member cap_id is not initialized in this
  constructor nor in any functions that it calls.
 uninit_member: Non-static class member issue_seq is not initialized in
  this constructor nor in any functions that it calls.
 uninit_member: Non-static class member mseq is not initialized in this
  constructor nor in any functions that it calls.

Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
Fix for:

CID 1019612 (#1 of 1): Uninitialized scalar field (UNINIT_CTOR)
 uninit_member: Non-static class member before is not initialized in
  this constructor nor in any functions that it calls.
 uninit_member: Non-static class member seq is not initialized in
  this constructor nor in any functions that it calls.
 uninit_member: Non-static class member last_issue is not initialized
  in this constructor nor in any functions that it calls.

Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
Fix for:

CID 717368 (#1 of 1): Uninitialized scalar field (UNINIT_CTOR)
 uninit_member: Non-static class member is_truncated is not initialized
  in this constructor nor in any functions that it calls.

Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
@liewegas liewegas merged commit 53fb099 into master Nov 11, 2016
@liewegas liewegas deleted the wip-da-SCA-20160219 branch November 11, 2016 19:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants