Commit Graph

21491 Commits

Author SHA1 Message Date
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
Sage Weil
cf6639a049 perfcounters: remove unused members
Avoids coverity warning

CID 717214: Uninitialized scalar field (UNINIT_CTOR)
At (2): Non-static class member "m_shutdown_fd" 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:04 -07:00
Sage Weil
5846e27b73 obj_bencher: protect with lock
This makes coverity happy.

CID 716963: Data race condition (MISSING_LOCK)
At (1): Accessing "this->data.finished" ("bench_data.finished") requires the "Mutex._m" lock.

Signed-off-by: Sage Weil <sage@inktank.com>
2012-09-28 13:18:04 -07:00
Sage Weil
f577c8291f obj_bencher: possible divice by zero
CID 716903: Division or modulo by zero (DIVIDE_BY_ZERO) [select defect]

Signed-off-by: Sage Weil <sage@inktank.com>
2012-09-28 13:18:04 -07:00
Sage Weil
ce0633980e lockep: fix leak in failure/assert path
This is useless excepto make coverity happy.

CID 717075: Resource leak (RESOURCE_LEAK)
At (12): Variable "bt" going out of scope leaks the storage it points to.

Signed-off-by: Sage Weil <sage@inktank.com>
2012-09-28 13:18:04 -07:00
Sage Weil
4bd27998d9 ipaddr: fix buffer overrun on ipv6 prefix of 128
CID 717020: Out-of-bounds read (OVERRUN)
At (3): Overrunning array "addr->__in6_u.__u6_addr8" of 16 bytes at byte offset 16 using index "prefix_len / 8U" (which evaluates to 16).

Signed-off-by: Sage Weil <sage@inktank.com>
2012-09-28 13:18:04 -07:00
Sage Weil
6f897659ad config: don't leak buf on dump config
CID 717074: Resource leak (RESOURCE_LEAK)
At (26): 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:04 -07:00
Sage Weil
66f7c41ed5 buffer: init data val in ctor
CID 717213: Uninitialized pointer field (UNINIT_CTOR)
At (2): Non-static class member "data" 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:04 -07:00
Sage Weil
05dc45f68f buffer: restore stream state after hexdump()
CID 717129: Not restoring ostream format (STREAM_FORMAT_STATE)
At (51): 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:04 -07:00
Sage Weil
9bd673f178 adminsocket: init vars in ctor
At (2): Non-static class member "m_version_hook" is not initialized in this constructor nor in any functions that it calls.
CID 717212: Uninitialized pointer field (UNINIT_CTOR)
At (4): Non-static class member "m_help_hook" 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:04 -07:00
Sage Weil
dfb9488a42 adminsocket: change failure test
This makes coverity happier:

CID 716941: Using invalid iterator (INVALIDATE_ITERATOR)
At (35): Dereferencing iterator "p" though it is already past the end of its container.

only because it doesn't understand all the side-effects of the failure
branch above.

Signed-off-by: Sage Weil <sage@inktank.com>
2012-09-28 13:18:04 -07:00
Sage Weil
3ec32c94ab adminsocket: check return value
CID 716847: Other violation (CHECKED_RETURN)
At (5): Calling function "fcntl(sock_fd, 2, 1)" without checking return value. This library function may fail and return an error code.
At (6): No check of the return value of "fcntl(sock_fd, 2, 1)".

Signed-off-by: Sage Weil <sage@inktank.com>
2012-09-28 13:18:03 -07:00
Sage Weil
73d854975e workqueue: reset heartbeat timeout under lock
This makes coverity happier:

CID 727967: Value not atomically updated (ATOMICITY)
At (44): Using an unreliable value of "hb" inside the second locked section. If the data that "hb" depends on was changed by another thread, this use might be incorrect.

Signed-off-by: Sage Weil <sage@inktank.com>
2012-09-28 13:18:03 -07:00
Sage Weil
bdadc4eca6 MemoryModel: init in ctor
CID 717211: Uninitialized scalar field (UNINIT_CTOR)
At (18): Non-static class member field "last.mmap" 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:03 -07:00
Sage Weil
8d4e6e2a4c LogEntry: init in ctor
Signed-off-by: Sage Weil <sage@inktank.com>
2012-09-28 13:18:03 -07:00
John Wilkins
698403789e doc: Added commentary for BMC and VLAN.
Signed-off-by: John Wilkins <john.wilkins@inktank.com>
2012-09-28 13:18:03 -07:00
Sage Weil
404e7589d1 Merge remote-tracking branch 'gh/wip-osd-caps'
Reviewed-by: Sage Weil <sage@inktank.com>
2012-09-27 16:34:03 -07:00
Josh Durgin
cc4dcf60f5 test: add more OSDCap unit tests
Check that allow_all() returns false when 'allow *' is not specified.
This would have caught #3228.
Add tests for the output operators as well.

Signed-off-by: Josh Durgin <josh.durgin@inktank.com>
2012-09-27 15:38:29 -07:00
Josh Durgin
de6e0d8112 OSDCaps: fix allow_all()
OSD_CAP_ANY is not a mask. Treating it as one made any allowance
equivalent to 'allow *'.

Fixes: #3228
Signed-off-by: Josh Durgin <josh.durgin@inktank.com>
2012-09-27 15:38:18 -07:00
Josh Durgin
e903ca7add OSDCap: fix output operators for caps
OSD_CAP_ANY is not a flag, but a value (0xff) that will always
be true when treated as a mask with a non-zero rwxa_t.

Don't duplicate the rwxa_t output operator in the OSDCapSpec output
operator, just use it.

Signed-off-by: Josh Durgin <josh.durgin@inktank.com>
2012-09-27 15:36:48 -07:00
Josh Durgin
1d747d1eb9 OSDCap: fix typo in comment
The grammar uses auid, not uid.

Signed-off-by: Josh Durgin <josh.durgin@inktank.com>
2012-09-27 15:36:47 -07:00
John Wilkins
30e10a9ac9 doc: RST cleanup for RPM dev package installs.
Signed-off-by: John Wilkins <john.wilkins@inktank.com>
2012-09-27 15:02:42 -07:00
John Wilkins
2fc29fe9ef doc: Removed old ops directory structure and redundant files.
Signed-off-by: John Wilkins <john.wilkins@inktank.com>
2012-09-27 15:02:05 -07:00
Sam Lang
ff96789e46 client: add WARN_UNUSED_RESULT to client init func
Adds the gcc attribute (if available) to client init functions to
ensure proper error handling.

Signed-off-by: Sam Lang <sam.lang@inktank.com>
2012-09-27 14:34:29 -07:00
Sam Lang
27c7c71f14 client: Remove unmaintained ldceph.cc from tree
Signed-off-by: Sam Lang <sam.lang@inktank.com>
2012-09-27 14:34:29 -07:00
Sam Lang
a1cfe74ae8 client: Mods to fix #3184 for messenger shutdown
This moves the shutdown of the messenger outside of the client
to be able to handle error cases more appropriately.

Signed-off-by: Sam Lang <sam.lang@inktank.com>
2012-09-27 14:34:29 -07:00
Dan Mick
1d231f9364 Refresh manpages from .rst sources
Signed-off-by: Dan Mick <dan.mick@inktank.com>
2012-09-27 14:33:04 -07:00
Dan Mick
3c1e2e1928 manpage-howto.txt: note that man/Makefile.am may need update too
Signed-off-by: Dan Mick <dan.mick@inktank.com>
2012-09-27 14:33:04 -07:00