On (01/09/16 17:22), Fabiano Fidêncio wrote:
>On Thu, Sep 1, 2016 at 5:12 PM, Lukas Slebodnik <[email protected]> wrote:
>> On (30/08/16 17:07), Lukas Slebodnik wrote:
>>>On (30/08/16 16:59), Fabiano Fidêncio wrote:
>>>>Lukaš,
>>>>
>>>>On Tue, Aug 30, 2016 at 4:54 PM, Lukas Slebodnik <[email protected]> 
>>>>wrote:
>>>>> ehlo,
>>>>>
>>>>> Clang static analyzer assume that ldb_search can found
>>>>> 0 entries in the tree "cn=sysdb". Thenvariable version
>>>>> could be used uninitialized.
>>>>>
>>>>> We cannot get to such state in sssd but we already handle
>>>>> a case for more then one entry.
>>>>
>>>>I don't think this is the right approach as res->count == 0 seems to
>>>>be a valid case for a newly created database (please, correct me if
>>>>I'm wrong).
>>>>
>>>Agree
>>>
>>>I should have tried to run unit test before sending a patch
>>>
>> I looked deeper to the clang report
>> And there are wrong assumption that output variable
>> "version" is not initialized if function sysdb_cache_connect
>> returns ERR_SYSDB_VERSION_TOO_OLD or ERR_SYSDB_VERSION_TOO_NEW
>>
>> The reality is that output variable "version" is initialized
>> especially for these two case.
>>
>> It is a false positive but we might suppress the warning
>> with initializing variable to NULL.
>
>Indeed!
>Are you planning to submit this one-liner for review as well?
>
I can.

LS
>From f01691b5f1ec800f7f717f4358197d99c17f35a7 Mon Sep 17 00:00:00 2001
From: Lukas Slebodnik <[email protected]>
Date: Thu, 1 Sep 2016 17:25:23 +0200
Subject: [PATCH] SYSDB: Suppress warning from clang static analyser

scan-build wrongly assumes that output variable
"version" is not initialized if function sysdb_cache_connect
returns ERR_SYSDB_VERSION_TOO_OLD or ERR_SYSDB_VERSION_TOO_NEW

The reality is that output variable "version" is initialized
especially for these two case. Initialisation to NULL suppress
these false positive reports.
---
 src/db/sysdb_init.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/db/sysdb_init.c b/src/db/sysdb_init.c
index 
d110aa7a2878e47650db177cfd342d0ac32248ab..538ba027cd94e274ba328d398cc565b11ea56f39
 100644
--- a/src/db/sysdb_init.c
+++ b/src/db/sysdb_init.c
@@ -688,7 +688,7 @@ static int sysdb_domain_cache_connect(struct sysdb_ctx 
*sysdb,
                                       struct sysdb_dom_upgrade_ctx 
*upgrade_ctx)
 {
     errno_t ret;
-    const char *version;
+    const char *version = NULL;
     TALLOC_CTX *tmp_ctx;
     struct ldb_context *ldb;
 
-- 
2.9.3

_______________________________________________
sssd-devel mailing list
[email protected]
https://lists.fedorahosted.org/admin/lists/[email protected]

Reply via email to