diff mbox series

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

Message ID 55401269-240e-43ca-83fa-97b089de5f19@schaufler-ca.com (mailing list archive)
State Under Review
Delegated to: Paul Moore
Headers show
Series [lsm/dev-staging] selinux: Fix pointer use in selinux_dentry_init_security | expand

Commit Message

Casey Schaufler Nov. 2, 2024, 7:37 p.m. UTC
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@schaufler-ca.com>
---
 security/selinux/hooks.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Comments

Paul Moore Nov. 5, 2024, 10:26 p.m. UTC | #1
On Sat, Nov 2, 2024 at 3:37 PM Casey Schaufler <casey@schaufler-ca.com> wrote:
>
> 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@schaufler-ca.com>
> ---
>  security/selinux/hooks.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)

Merged into lsm/dev-staging.
diff mbox series

Patch

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,