[PATCH 1/1] libsepol/cil: call cil_reset_context() when context is not NULL

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



cil_reset_context() dereferences its argument, which is thus expected
not to be NULL. The if statement in cil_reset_ibpkeycon() verified the
opposite condition. Fix this.

This issue has been found using clang's static analyzer.

Signed-off-by: Nicolas Iooss <nicolas.iooss@xxxxxxx>
---
 libsepol/cil/src/cil_reset_ast.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libsepol/cil/src/cil_reset_ast.c b/libsepol/cil/src/cil_reset_ast.c
index 73034a97956b..dd047c8e0409 100644
--- a/libsepol/cil/src/cil_reset_ast.c
+++ b/libsepol/cil/src/cil_reset_ast.c
@@ -290,7 +290,7 @@ static void cil_reset_filecon(struct cil_filecon *filecon)
 
 static void cil_reset_ibpkeycon(struct cil_ibpkeycon *ibpkeycon)
 {
-	if (!ibpkeycon->context)
+	if (ibpkeycon->context)
 		cil_reset_context(ibpkeycon->context);
 }
 
-- 
2.13.0




[Index of Archives]     [Selinux Refpolicy]     [Linux SGX]     [Fedora Users]     [Fedora Desktop]     [Yosemite Photos]     [Yosemite Camping]     [Yosemite Campsites]     [KDE Users]     [Gnome Users]

  Powered by Linux