Commit Graph

21522 Commits

Author SHA1 Message Date
Sage Weil
82aecedf30 mds: fix uninit field in CInode
CID 717231: Uninitialized scalar field (UNINIT_CTOR)
At (3): Non-static class member "auth_pin_freeze_allowance" is not initialized in this constructor nor in any functions that it calls.

Signed-off-by: Sage Weil <sage@inktank.com>
2012-09-29 01:11:41 -07:00
Sage Weil
1acd109296 mds: fix typo in rsubdirs warning
CID 716879: Copy-paste error (COPY_PASTE_ERROR)
At (2): "rfiles" in "pi->rstat.rfiles" looks like a copy-paste error. Should it say "rsubdirs" instead?

Signed-off-by: Sage Weil <sage@inktank.com>
2012-09-29 01:09:43 -07:00
Sage Weil
310e486817 mds: init CDir fields
CID 717230: Uninitialized scalar field (UNINIT_CTOR)
At (8): Non-static class member "num_dentries_auth_subtree_nested" is not initialized in this constructor nor in any functions that it calls.

Signed-off-by: Sage Weil <sage@inktank.com>
2012-09-29 01:08:30 -07:00
Sage Weil
5e51f5506a mds: avoid useless have_inode() call
CID 716989: Dereference null return value (NULL_RETURNS)
At (83): Dereferencing a pointer that might be null "in" when calling "operator <<(std::ostream &, CInode &)". [hide details]

Signed-off-by: Sage Weil <sage@inktank.com>
2012-09-29 01:06:38 -07:00
Sage Weil
6047325763 osd: pass by value
CID 717054: Big parameter passed by value (PASS_BY_VALUE)
At (1): Passing parameter recovery_info of type ObjectRecoveryInfo (size 640 bytes) by value.

and more

Signed-off-by: Sage Weil <sage@inktank.com>
2012-09-29 00:59:54 -07:00
Sage Weil
af1153147a osd: fix coverity NULL warning
Session is alwasy set on requests.

CID 717008: Dereference null return value (NULL_RETURNS)
At (34): Dereferencing a pointer that might be null "session" when calling "OSD::Session::del_notif(void *)". [hide details]

Signed-off-by: Sage Weil <sage@inktank.com>
2012-09-29 00:57:40 -07:00
Sage Weil
ada0db3660 osd: logger is never NULL
We set this up in init(), so we don't need to make these dereferences
conditional.

Signed-off-by: Sage Weil <sage@inktank.com>
2012-09-29 00:53:28 -07:00
Sage Weil
020856bba8 osd/PG: remove redundant NamedState
Signed-off-by: Sage Weil <sage@inktank.com>
2012-09-29 00:51:08 -07:00
Sage Weil
0769a1d35e osd: init all vars in PG::NamedState
CID 717341: Uninitialized pointer field (UNINIT_CTOR)
At (2): Non-static class member "state_name" is not initialized in this constructor nor in any functions that it calls.

Signed-off-by: Sage Weil <sage@inktank.com>
2012-09-29 00:50:57 -07:00
Sage Weil
09f602d2fb ceph tool: fix cli test
Signed-off-by: Sage Weil <sage@inktank.com>
2012-09-28 18:34:26 -07:00
Sage Weil
7827c566ad mon: fix uninit var warning in session startup
This is a false positive; just init the var.

CID 717198: Uninitialized scalar variable (UNINIT)
At (18): Using uninitialized value "auid" when calling "MonCaps::set_auid(uint64_t)". [hide details]

Signed-off-by: Sage Weil <sage@inktank.com>
2012-09-28 18:16:49 -07:00
Sage Weil
f4c34c06e9 filstore: fix leak of fd in write error paths
CID 717095: Resource leak (RESOURCE_LEAK)
At (13): Handle variable "fd" going out of scope leaks the handle.

Signed-off-by: Sage Weil <sage@inktank.com>
2012-09-28 18:14:24 -07:00
Sage Weil
e0820d2120 filestore: fix fd leak
CID 717088: Resource leak (RESOURCE_LEAK)
At (11): Handle variable "tmpfd" going out of scope leaks the handle.

Also unlink the file.

Signed-off-by: Sage Weil <sage@inktank.com>
2012-09-28 18:12:34 -07:00
Sage Weil
dfac9b34c2 mds: dentry always has dir
CID 716912: Dereference after null check (FORWARD_NULL)
At (3): Passing null pointer "this->dir" to function "CDir::ino() const", which dereferences it. [hide details]

Signed-off-by: Sage Weil <sage@inktank.com>
2012-09-28 17:56:34 -07:00
Sage Weil
d5f8e42b14 librbd: init value in CopyProgressCtx ctor
CID 717227: Uninitialized pointer field (UNINIT_CTOR)
At (4): Non-static class member "src_size" is not initialized in this constructor nor in any functions that it calls.

Signed-off-by: Sage Weil <sage@inktank.com>
2012-09-28 17:54:34 -07:00
Sage Weil
e43f4ff872 librbd: fix overflow assert check
Signed-off-by: Sage Weil <sage@inktank.com>
2012-09-28 17:53:29 -07:00
Sage Weil
5a0461af57 ceph tool: update url in man page
Signed-off-by: Sage Weil <sage@inktank.com>
2012-09-28 17:38:02 -07:00
Sage Weil
f1f7ac7879 ceph tool: document 'ceph osd map ...' command
Closes: #3223
Signed-off-by: Sage Weil <sage@inktank.com>
2012-09-28 17:37:53 -07:00
Sage Weil
da43de34e6 Merge remote-tracking branch 'gh/wip-coverity-common'
Reviewed-by: Samuel Just <sam.just@inktank.com>
2012-09-28 17:31:41 -07:00
Samuel Just
1d675cc064 Merge branch 'next' 2012-09-28 16:31:27 -07:00
Samuel Just
c925ce8663 FileStore: use fresh vector for calls for listing collection
In collection_list_range, use an empty vector to pass into
collection_list_partial.  collection_list_partial stops
listing when the output vector exceeds the specified max.
If this happens before we hit the end of the range,
collection_list_range will spin forever.

Signed-off-by: Samuel Just <sam.just@inktank.com>
Reviewed-by: Mike Ryan <mike.ryan@inktank.com>
Reviewed-by: Greg Farnum <greg@inktank.com>
2012-09-28 16:29:28 -07:00
Sage Weil
e61b965a5f osdmap: restore stream format
CID 727986: Not restoring ostream format (STREAM_FORMAT_STATE)
At (20): Changing format state of stream "out" for category precision without later restoring it.

Signed-off-by: Sage Weil <sage@inktank.com>
2012-09-28 13:18:07 -07:00
Sage Weil
70e35ba9b1 cephtool: fix resource leak
CID 717124: Resource leak (RESOURCE_LEAK)
At (17): Variable "m" going out of scope leaks the storage it points to.

Signed-off-by: Sage Weil <sage@inktank.com>
2012-09-28 13:18:06 -07:00
Sage Weil
779e0f0fb0 cls_refcount: fix uninit vals in ctor
CID 727989: Uninitialized scalar field (UNINIT_CTOR)
At (2): Non-static class member "implicit_ref" is not initialized in this constructor nor in any functions that it calls.

+ a few others

Signed-off-by: Sage Weil <sage@inktank.com>
2012-09-28 13:18:06 -07:00
Sage Weil
67caceec18 rados: fix error paths in do_put()
CID 716986: Improper use of negative value (NEGATIVE_RETURNS)
At (9): "count" is passed to a parameter that cannot be negative. [hide details]

+ other stuff

Signed-off-by: Sage Weil <sage@inktank.com>
2012-09-28 13:18:06 -07:00
Sage Weil
903f60aee0 osdmaptool: fix pg_t::parse() return value check
CID 716876: Operands don't affect result (CONSTANT_EXPRESSION_RESULT)
At (1): pgid.parse(test_map_pg.c_str()) < 0 is always false regardless of the values of its operands. This occurs as the logical operand of if.

Signed-off-by: Sage Weil <sage@inktank.com>
2012-09-28 13:18:06 -07:00
Sage Weil
d5b4f9af42 osdmaptool: check return values
CID 716864: Unchecked return value (CHECKED_RETURN)
At (155): Calling function "ceph::buffer::list::read_file(char const *, std::string *)" without checking return value (as is done elsewhere 14 out of 16 times).

Signed-off-by: Sage Weil <sage@inktank.com>
2012-09-28 13:18:06 -07:00
Sage Weil
0b3c5dc58c objecter: fix dereference after null check
CID 716933: Dereference after null check (FORWARD_NULL)
At (4): Passing null pointer "extra_ops->ops" to function "std::vector<OSDOp, std::allocator<OSDOp> >::operator [](std::vector<OSDOp, std::allocator<OSDOp> >::size_type)", which dereferences it. [hide details]

All callers pass 1, but this was also hard-coded into the helper logic.
Fix code (and doxygen desc) to allow other values.

Signed-off-by: Sage Weil <sage@inktank.com>
2012-09-28 13:18:06 -07:00
Sage Weil
b1d85130d1 objectcacher: fix uninit var in ctor
CID 717351: Uninitialized scalar field (UNINIT_CTOR)
At (2): Non-static class member "tid" is not initialized in this constructor nor in any functions that it calls.

Signed-off-by: Sage Weil <sage@inktank.com>
2012-09-28 13:18:06 -07:00
Sage Weil
62273b5cbf objectcacher: fix uninit it ctor
CID 717350: Uninitialized scalar field (UNINIT_CTOR)
At (4): Non-static class member field "ex.length" is not initialized in this constructor nor in any functions that it calls.

Signed-off-by: Sage Weil <sage@inktank.com>
2012-09-28 13:18:06 -07:00
Sage Weil
e5103b44bc objectcacher: avoid confusing coverity
CID 716932: Explicit null dereferenced (FORWARD_NULL)
At (21): Passing null pointer "final" to function "ObjectCacher::BufferHead::end() const", which dereferences it. [hide details]

Signed-off-by: Sage Weil <sage@inktank.com>
2012-09-28 13:18:06 -07:00
Sage Weil
a1f9dbc690 journaler: uninit var in ctor
CID 717349: Uninitialized scalar field (UNINIT_CTOR)
At (14): Non-static class member field "layout.fl_pg_pool" is not initialized in this constructor nor in any functions that it calls.

Signed-off-by: Sage Weil <sage@inktank.com>
2012-09-28 13:18:06 -07:00
Sage Weil
7b90139f4e journaler: uninit var in ctor
CID 717348: Uninitialized scalar field (UNINIT_CTOR)
At (14): Non-static class member field "layout.fl_pg_pool" is not initialized in this constructor nor in any functions that it calls.

Signed-off-by: Sage Weil <sage@inktank.com>
2012-09-28 13:18:06 -07:00
Sage Weil
50460f90f5 filer: fix overflow
CID 717017: Unintentional integer overflow (OVERFLOW_BEFORE_WIDEN)
At (1): Potentially overflowing expression "layout->fl_stripe_count.operator unsigned int() * layout->fl_object_size.operator unsigned int()" with type "unsigned int" (32 bits, unsigned) is evaluated using 32-bit arithmetic before being used in a context which expects an expression of type "uint64_t" (64 bits, unsigned). To avoid overflow, cast either operand to "uint64_t" before performing the multiplication.

+ more

Signed-off-by: Sage Weil <sage@inktank.com>
2012-09-28 13:18:06 -07:00
Sage Weil
d2cbe1fb6d MOSDFailure: avoid big pass by value
CID 727975: Big parameter passed by value (PASS_BY_VALUE)
At (1): Passing parameter f of type entity_inst_t (size 152 bytes) by value.

Signed-off-by: Sage Weil <sage@inktank.com>
2012-09-28 13:18:06 -07:00
Sage Weil
cb0d9690a7 MMonJoin: avoid large pass by value
CID 717036: Big parameter passed by value (PASS_BY_VALUE)
At (1): Passing parameter a of type entity_addr_t (size 136 bytes) by value.

Signed-off-by: Sage Weil <sage@inktank.com>
2012-09-28 13:18:06 -07:00
Sage Weil
e92b92b2b6 MRoute: avoid pass by value
CID 717038: Big parameter passed by value (PASS_BY_VALUE)
At (1): Passing parameter i of type entity_inst_t (size 152 bytes) by value.

Signed-off-by: Sage Weil <sage@inktank.com>
2012-09-28 13:18:05 -07:00
Sage Weil
02e48394cc messages: uninit values
CID 717259: Uninitialized scalar field (UNINIT_CTOR)
At (2): Non-static class member "global_id" is not initialized in this constructor nor in any functions that it calls.

CID 728086: Uninitialized scalar field (UNINIT_CTOR)
At (4): Non-static class member "type" is not initialized in this constructor nor in any functions that it calls.

CID 717260: Uninitialized scalar field (UNINIT_CTOR)
At (2): Non-static class member "from" is not initialized in this constructor nor in any functions that it calls.

CID 717261: Uninitialized scalar field (UNINIT_CTOR)
At (51): Non-static class member field "head.time_warp_seq" is not initialized in this constructor nor in any functions that it calls.

+ more

Signed-off-by: Sage Weil <sage@inktank.com>
2012-09-28 13:18:05 -07:00
Sage Weil
b5fb298d38 msg/Messenger: avoid large pass by value
CID 717049: Big parameter passed by value (PASS_BY_VALUE)
At (1): Passing parameter bind_addr of type entity_addr_t (size 136 bytes) by value.

Signed-off-by: Sage Weil <sage@inktank.com>
2012-09-28 13:18:05 -07:00
Sage Weil
797d3ccb7a msg/Accepter: check getsockbyname() return value
CID 717442: Other violation (CHECKED_RETURN)
At (10): Calling function "getsockname(this->listen_sd, (sockaddr *)listen_addr.ss_addr(), &llen)" without checking return value. This library function may fail and return an error code.
At (11): No check of the return value of "getsockname(this->listen_sd, (sockaddr *)listen_addr.ss_addr(), &llen)".

Signed-off-by: Sage Weil <sage@inktank.com>
2012-09-28 13:18:05 -07:00
Sage Weil
ae1c38f195 LogEntry: fix uninit in ctor
At (2): Non-static class member "m_thread" is not initialized in this constructor nor in any functions that it calls.
At (4): Non-static class member "m_prio" is not initialized in this constructor nor in any functions that it calls.
At (6): Non-static class member "m_subsys" is not initialized in this constructor nor in any functions that it calls.
CID 717229: Uninitialized scalar field (UNINIT_CTOR)
At (8): Non-static class member "m_static_buf" is not initialized in this constructor nor in any functions that it calls.

Signed-off-by: Sage Weil <sage@inktank.com>
2012-09-28 13:18:05 -07:00
Sage Weil
2381f12a04 utime: restore ostream state
CID 717130: Not restoring ostream format (STREAM_FORMAT_STATE)
At (4): Changing format state of stream "out" for category fill without later restoring it.

CID 717131: Not restoring ostream format (STREAM_FORMAT_STATE)
At (4): Changing format state of stream "out" for category fill without later restoring it.

Signed-off-by: Sage Weil <sage@inktank.com>
2012-09-28 13:18:05 -07:00
Sage Weil
95dca9895b stringify: use const ref
CID 727974: Big parameter passed by value (PASS_BY_VALUE)
At (1): Passing parameter a of type entity_addr_t (size 136 bytes) by value.

Signed-off-by: Sage Weil <sage@inktank.com>
2012-09-28 13:18:05 -07:00
Sage Weil
884daeb108 addr_parsing: fix memory leak
CID 717082: Resource leak (RESOURCE_LEAK)
At (4): Variable "buf" going out of scope leaks the storage it points to.

Signed-off-by: Sage Weil <sage@inktank.com>
2012-09-28 13:18:05 -07:00
Sage Weil
98da9f9b8c pidfile: fix fd leak from pidfile_remove()
CID 717081: Resource leak (RESOURCE_LEAK)
At (10): Handle variable "fd" going out of scope leaks the handle.

Signed-off-by: Sage Weil <sage@inktank.com>
2012-09-28 13:18:05 -07:00
Sage Weil
687d6d58f1 crushtester: fix uninit var
CID 717197: Uninitialized scalar variable (UNINIT)
At (35): Using uninitialized value "only_osd_affected".

Fix some whitespace too.

Signed-off-by: Sage Weil <sage@inktank.com>
2012-09-28 13:18:05 -07:00
Sage Weil
b7cf6030ae crushtester: avoid divide by zero
CID 716906: Division or modulo by zero (DIVIDE_BY_ZERO)
At (214): In expression "(float)weight[i] / (float)total_weight", division by expression "total_weight" which may be zero has undefined behavior.

Signed-off-by: Sage Weil <sage@inktank.com>
2012-09-28 13:18:05 -07:00
Sage Weil
ffe0e09b95 crushtester: avoid divide by zero
CID 716904: Division or modulo by zero (DIVIDE_BY_ZERO)
At (4): In expression "(float)weight[i] / (float)total_weight", division by expression "total_weight" which may be zero has undefined behavior.

At (8): On this path, function call "this->crush->get_max_devices()" has return value of 0
CID 716905: Division or modulo by zero (DIVIDE_BY_ZERO)
At (9): In expression "lrand48() % this->crush->get_max_devices()" modulo by expression "this->crush->get_max_devices()" which may be zero has undefined behavior.

Signed-off-by: Sage Weil <sage@inktank.com>
2012-09-28 13:18:04 -07:00
Sage Weil
7490032008 adminsocket: fix sock-fd leak in failure path
CID 728088: Resource leak (RESOURCE_LEAK)
At (9): Handle variable "sock_fd" going out of scope leaks the handle.

Signed-off-by: Sage Weil <sage@inktank.com>
2012-09-28 13:18:04 -07:00
Sage Weil
af5f143736 PrebufferedStream: avoid dereferencing end()
This appeared to work, but probably isn't a good idea.

CID 716940: Using invalid iterator (INVALIDATE_ITERATOR)
At (4): Dereferencing iterator "this->m_overflow.end()" though it is already past the end of its container.

Signed-off-by: Sage Weil <sage@inktank.com>
2012-09-28 13:18:04 -07:00