Reported by Clang. See patch description for more info.

Patch is in attachment.

Thanks,
Michal
>From a0c94bc4c5df2955e82a7dc0852a86019286577e Mon Sep 17 00:00:00 2001
From: Michal Zidek <mzi...@redhat.com>
Date: Fri, 4 Apr 2014 16:53:48 +0200
Subject: [PATCH] Passing NULL as map_order in create_order_array is invalid.

Reported by Clang. This is actually false positive because
a NULL pointer in map_order would cause the function above
(sysdb_store_selinux_config) to fail and create_order_array
would be skipped. So this patch is another line of
defense that just makes the code more readable and silences
the message from Clang.
---
 src/providers/ipa/ipa_selinux.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/providers/ipa/ipa_selinux.c b/src/providers/ipa/ipa_selinux.c
index e0d7a00..5ee1e74 100644
--- a/src/providers/ipa/ipa_selinux.c
+++ b/src/providers/ipa/ipa_selinux.c
@@ -595,6 +595,10 @@ static errno_t create_order_array(TALLOC_CTX *mem_ctx, const char *map_order,
     int len;
     size_t order_count;
 
+    if (map_order == NULL) {
+        return EINVAL;
+    }
+
     tmp_ctx = talloc_new(NULL);
     if (tmp_ctx == NULL) {
         ret = ENOMEM;
-- 
1.7.11.2

_______________________________________________
sssd-devel mailing list
sssd-devel@lists.fedorahosted.org
https://lists.fedorahosted.org/mailman/listinfo/sssd-devel

Reply via email to