[Patch lsm/dev-staging] selinux: Fix pointer use in selinux_dentry_init_security

Casey Schaufler casey at schaufler-ca.com
Sat Nov 2 19:37:36 UTC 2024


The cast used while calling security_sid_to_context() is just wrong.
Use the address of the pointer instead.

Signed-off-by: Casey Schaufler <casey at schaufler-ca.com>
---
 security/selinux/hooks.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c
index 996e765b6823..93d2773bfda5 100644
--- a/security/selinux/hooks.c
+++ b/security/selinux/hooks.c
@@ -2886,8 +2886,7 @@ static int selinux_dentry_init_security(struct dentry *dentry, int mode,
 		*xattr_name = XATTR_NAME_SELINUX;
 
 	cp->id = LSM_ID_SELINUX;
-	return security_sid_to_context(newsid, (char **)cp->context,
-				       &cp->len);
+	return security_sid_to_context(newsid, &cp->context, &cp->len);
 }
 
 static int selinux_dentry_create_files_as(struct dentry *dentry, int mode,




More information about the Linux-security-module-archive mailing list