Skip to content

Commit

Permalink
selinux: use correct type for context length
Browse files Browse the repository at this point in the history
[ Upstream commit b97df7c ]

security_sid_to_context() expects a pointer to an u32 as the address
where to store the length of the computed context.

Reported by sparse:

    security/selinux/xfrm.c:359:39: warning: incorrect type in arg 4
                                    (different signedness)
    security/selinux/xfrm.c:359:39:    expected unsigned int
                                       [usertype] *scontext_len
    security/selinux/xfrm.c:359:39:    got int *

Signed-off-by: Christian Göttsche <cgzones@googlemail.com>
[PM: wrapped commit description]
Signed-off-by: Paul Moore <paul@paul-moore.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
cgzones authored and gregkh committed Apr 8, 2022
1 parent c01fced commit eef8909
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion security/selinux/xfrm.c
Expand Up @@ -347,7 +347,7 @@ int selinux_xfrm_state_alloc_acquire(struct xfrm_state *x,
int rc;
struct xfrm_sec_ctx *ctx;
char *ctx_str = NULL;
int str_len;
u32 str_len;

if (!polsec)
return 0;
Expand Down

0 comments on commit eef8909

Please sign in to comment.