[SSSD] [PATCH] IFP: cached objects
Pavel Březina
pbrezina at redhat.com
Thu Jun 18 12:12:58 UTC 2015
On 06/02/2015 03:49 PM, Pavel Březina wrote:
> On 06/02/2015 02:17 PM, Lukas Slebodnik wrote:
>> On (02/06/15 11:18), Pavel Březina wrote:
>>> On 05/26/2015 05:22 PM, Jakub Hrozek wrote:
>>>> There is a compilation warning discovered by Coverity:
>> It is gcc-5.1 warning and not coverity
>> I can see them as well.
>>
>>>> Error: COMPILER_WARNING:
>>>> sssd-1.12.90/src/responder/ifp/ifp_cache.c:118:13: warning:
>>>> 'base_dn' may be used uninitialized in this function
>>>> [-Wmaybe-uninitialized]
>>>> # 116| }
>>>> # 117|
>>>> # 118|-> ldb_ret = ldb_search(sysdb_ctx_get_ldb(domain->sysdb),
>>>> tmp_ctx, &result,
>>>> # 119| base_dn, LDB_SCOPE_SUBTREE, attrs,
>>>> # 120| "(&(objectClass=%s)(%s=TRUE))",
>>>> class, SYSDB_CACHED);
>>>>
>>>> Error: COMPILER_WARNING:
>>>> sssd-1.12.90/src/responder/ifp/ifp_cache.c:118:13: warning: 'class'
>>>> may be used uninitialized in this function [-Wmaybe-uninitialized]
>>>> # ldb_ret = ldb_search(sysdb_ctx_get_ldb(domain->sysdb),
>>>> tmp_ctx, &result,
>>>> # ^
>>>> # 116| }
>>>> # 117|
>>>> # 118|-> ldb_ret = ldb_search(sysdb_ctx_get_ldb(domain->sysdb),
>>>> tmp_ctx, &result,
>>>> # 119| base_dn, LDB_SCOPE_SUBTREE, attrs,
>>>> # 120| "(&(objectClass=%s)(%s=TRUE))",
>>>> class, SYSDB_CACHED);
>>>>
>>>> Error: COMPILER_WARNING:
>>>> sssd-1.12.90/src/responder/ifp/ifp_cache.c: scope_hint: In function
>>>> 'ifp_cache_get_cached_objects'
>>>> sssd-1.12.90/src/responder/ifp/ifp_cache.c:134:18: warning: 'path'
>>>> may be used uninitialized in this function [-Wmaybe-uninitialized]
>>>> # paths[i] = ifp_cache_build_path(paths, type, domain,
>>>> result->msgs[i]);
>>>> # ^
>>>> # 132|
>>>> # 133| for (i = 0; i < result->count; i++) {
>>>> # 134|-> paths[i] = ifp_cache_build_path(paths, type,
>>>> domain, result->msgs[i]);
>>>> # 135| if (paths[i] == NULL) {
>>>> # 136| ret = ENOMEM;
>>>
>>> I don't see how those warning happends... base_dn, class and paths is
>>> initialized.
>> It seems that gcc 5.1 optimize enum in some ways
>> and expects that functions ifp_cache_build_path and
>> ifp_cache_build_base_dn
>> can return unitialized value.
>> If you do not wan to add Defualt to switch then you can initialize
>> local variabels in these functions.
>>
>> diff --git a/src/responder/ifp/ifp_cache.c
>> b/src/responder/ifp/ifp_cache.c
>> index 4e5f59c..949c3f9 100644
>> --- a/src/responder/ifp/ifp_cache.c
>> +++ b/src/responder/ifp/ifp_cache.c
>> @@ -34,7 +34,7 @@ ifp_cache_build_base_dn(TALLOC_CTX *mem_ctx,
>> enum ifp_cache_type type,
>> struct sss_domain_info *domain)
>> {
>> - struct ldb_dn *base_dn;
>> + struct ldb_dn *base_dn = NULL;
>>
>> switch (type) {
>> case IFP_CACHE_USER:
>> @@ -54,7 +54,7 @@ ifp_cache_build_path(TALLOC_CTX *mem_ctx,
>> struct sss_domain_info *domain,
>> struct ldb_message *msg)
>> {
>> - char *path;
>> + char *path = NULL;
>>
>> switch (type) {
>> case IFP_CACHE_USER:
>>
>> LS
> Thanks, new patch is attached.
Jakub wanted me to do two little modifications:
1) use sysdb_error_to_errno for ldb errors
2) change attr name ifp_cached to ifpCached
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-IFP-Implement-org.freedesktop.sssd.infopipe.Cache-.O.patch
Type: text/x-patch
Size: 32424 bytes
Desc: not available
URL: <https://lists.fedorahosted.org/pipermail/sssd-devel/attachments/20150618/84b5f9f7/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0002-SBUS-Use-default-GetAll-invoker-if-none-is-set.patch
Type: text/x-patch
Size: 1235 bytes
Desc: not available
URL: <https://lists.fedorahosted.org/pipermail/sssd-devel/attachments/20150618/84b5f9f7/attachment-0001.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0003-SBUS-Add-support-for-node-in-introspection.patch
Type: text/x-patch
Size: 10837 bytes
Desc: not available
URL: <https://lists.fedorahosted.org/pipermail/sssd-devel/attachments/20150618/84b5f9f7/attachment-0002.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0004-IFP-Export-nodes.patch
Type: text/x-patch
Size: 11182 bytes
Desc: not available
URL: <https://lists.fedorahosted.org/pipermail/sssd-devel/attachments/20150618/84b5f9f7/attachment-0003.bin>
More information about the sssd-devel
mailing list