csomh / rpms / acl

Forked from rpms/acl 4 years ago
Clone

Blame SOURCES/acl-2.2.52-setfacl-restore-initialize.patch

7fbafb
From eb123384d1e4001b62a578ec1df53aa23016aed3 Mon Sep 17 00:00:00 2001
7fbafb
From: Andreas Gruenbacher <agruenba@redhat.com>
7fbafb
Date: Fri, 17 Mar 2017 10:17:01 +0100
7fbafb
Subject: [PATCH] setfacl --restore: Silence valgrind
7fbafb
7fbafb
Valgrind complains that setfacl --restore triggers uninitialized memory
7fbafb
accesses to cmd->c_tag and cmd->c_perm of CMD_REMOVE_ACL commands in
7fbafb
do_set (http://savannah.nongnu.org/bugs/?50566).  In this case, the
7fbafb
uninitialized memory accesses have no effect.  Silence valgrind by
7fbafb
initializing cmd->c_tag and cmd->c_perm anyway.
7fbafb
7fbafb
Upstream-commit: 33f01b5d5bd98fceee0ba46cdbddb60b36fc650e
7fbafb
Signed-off-by: Kamil Dudka <kdudka@redhat.com>
7fbafb
---
7fbafb
 setfacl/sequence.c | 9 ++++++++-
7fbafb
 1 file changed, 8 insertions(+), 1 deletion(-)
7fbafb
7fbafb
diff --git a/setfacl/sequence.c b/setfacl/sequence.c
7fbafb
index a418b23..5ed182e 100644
7fbafb
--- a/setfacl/sequence.c
7fbafb
+++ b/setfacl/sequence.c
7fbafb
@@ -29,7 +29,14 @@ cmd_t
7fbafb
 cmd_init(
7fbafb
 	void)
7fbafb
 {
7fbafb
-	return (cmd_t)malloc(sizeof(struct cmd_obj));
7fbafb
+	cmd_t cmd;
7fbafb
+
7fbafb
+	cmd = malloc(sizeof(struct cmd_obj));
7fbafb
+	if (cmd) {
7fbafb
+		cmd->c_tag = ACL_UNDEFINED_TAG;
7fbafb
+		cmd->c_perm = 0;
7fbafb
+	}
7fbafb
+	return cmd;
7fbafb
 }
7fbafb
 
7fbafb
 
7fbafb
-- 
7fbafb
2.9.4
7fbafb