[SSSD] [PATCHES] cache_req improvements

Lukas Slebodnik lslebodn at redhat.com
Thu Mar 12 12:05:22 UTC 2015


On (12/03/15 12:34), Pavel Březina wrote:
>On 03/12/2015 12:30 PM, Jakub Hrozek wrote:
>>On Thu, Mar 12, 2015 at 11:50:21AM +0100, Jakub Hrozek wrote:
>>>On Thu, Mar 12, 2015 at 11:16:41AM +0100, Jakub Hrozek wrote:
>>>>I'm also waiting for a Coverity check to finish.
>>>
>>>There are some warnings, mostly the same problem copied around:
>>>Error: COMPILER_WARNING:
>>>sssd-1.12.90/src/responder/common/responder_cache_req.c:232:8: warning: 'ret' may be used uninitialized in this function [-Wmaybe-uninitialized]
>>>#     if (ret == EEXIST) {
>>>#        ^
>>>sssd-1.12.90/src/responder/common/responder_cache_req.c:212:13: note: 'ret' was declared here
>>>#     errno_t ret;
>>>#             ^
>>>
>>>Error: COMPILER_WARNING:
>>>sssd-1.12.90/src/responder/common/responder_cache_req.c: scope_hint: In function 'cache_req_get_object'
>>>sssd-1.12.90/src/responder/common/responder_cache_req.c:343:8: warning: 'ret' may be used uninitialized in this function [-Wmaybe-uninitialized]
>>>#     if (ret != EOK) {
>>>#        ^
>>>
>>>Error: COMPILER_WARNING:
>>>sssd-1.12.90/src/responder/common/responder_cache_req.c:348:30: warning: 'one_item_only' may be used uninitialized in this function [-Wmaybe-uninitialized]
>>>#     } else if (one_item_only && result->count > 1) {
>>>#                              ^
>>>
>>>Error: COMPILER_WARNING:
>>>sssd-1.12.90/src/responder/common/responder_cache_req.c:26: included_from: Included from here.
>>>sssd-1.12.90/src/responder/common/responder_cache_req.c: scope_hint: In function 'cache_req_cache_done'
>>>sssd-1.12.90/src/util/util.h:130:9: warning: 'ret' may be used uninitialized in this function [-Wmaybe-uninitialized]
>>>#         debug_fn(__FILE__, __LINE__, __FUNCTION__, \
>>>#         ^
>>>sssd-1.12.90/src/responder/common/responder_cache_req.c:243:13: note: 'ret' was declared here
>>>#     errno_t ret;
>>>#             ^
>>>
>>>I think it's fine to initialize ret to ERR_INTERNAL in that case. We know
>>>that one of the 'case' statements would hit, so this change could be just
>>>another precaution.
>>
>>btw CI passed: http://sssd-ci.duckdns.org/logs/job/10/53/summary.html
>
>Thanks.
>
>Since those warning comes from original code that is already present in
>master, it is fixed in a separate patch (#1).
>
I do not agree with separate patch.
Firstly, it is compiler warning and not coverity
Secondly, it is caused by 7th patch
    cache_req: remove default branch from switches

  CC       src/responder/common/responder_cache_req.o
src/responder/common/responder_cache_req.c: In function ‘cache_req_get_object’:
src/responder/common/responder_cache_req.c:304:8: error: ‘ret’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
     if (ret != EOK) {
        ^
src/responder/common/responder_cache_req.c:309:30: error: ‘one_item_only’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
     } else if (one_item_only && result->count > 1) {
                              ^
src/responder/common/responder_cache_req.c: In function ‘cache_req_cache_done’:
src/responder/common/responder_cache_req.c:234:160: error: ‘ret’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
src/responder/common/responder_cache_req.c:213:13: note: ‘ret’ was declared here
     errno_t ret;
             ^
src/responder/common/responder_cache_req.c: In function ‘cache_req_next_domain’:
src/responder/common/responder_cache_req.c:262:160: error: ‘ret’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
src/responder/common/responder_cache_req.c:246:13: note: ‘ret’ was declared here
     errno_t ret;
             ^
src/responder/common/responder_cache_req.c:202:8: error: ‘ret’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
     if (ret == EEXIST) {
        ^
src/responder/common/responder_cache_req.c:185:13: note: ‘ret’ was declared here
     errno_t ret;
             ^
cc1: all warnings being treated as errors

sh$ rpm -q gcc
gcc-5.0.0-0.17.fc22.x86_64

I did not testen on fedora 21.

LS



More information about the sssd-devel mailing list