diff mbox series

[next] lsm: Fix signedness bug in selinux_secid_to_secctx()

Message ID 2d02f331-42ee-40db-a64f-5ee378eb44db@stanley.mountain (mailing list archive)
State Accepted
Delegated to: Paul Moore
Headers show
Series [next] lsm: Fix signedness bug in selinux_secid_to_secctx() | expand

Commit Message

Dan Carpenter Nov. 2, 2024, 9:31 a.m. UTC
The "ret" variable needs to be signed for the error checking to work.

Fixes: 95a3c11eb670 ("lsm: replace context+len with lsm_context")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
---
 security/selinux/hooks.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Casey Schaufler Nov. 2, 2024, 5:41 p.m. UTC | #1
On 11/2/2024 2:31 AM, Dan Carpenter wrote:
> The "ret" variable needs to be signed for the error checking to work.

Doh.

Thank you.

Acked-by: Casey Schaufler <casey@schaufler-ca.com>

>
> Fixes: 95a3c11eb670 ("lsm: replace context+len with lsm_context")
> Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
> ---
>  security/selinux/hooks.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c
> index eca9674c9478..0ff018f557ac 100644
> --- a/security/selinux/hooks.c
> +++ b/security/selinux/hooks.c
> @@ -6644,7 +6644,7 @@ static int selinux_ismaclabel(const char *name)
>  static int selinux_secid_to_secctx(u32 secid, struct lsm_context *cp)
>  {
>  	u32 seclen;
> -	u32 ret;
> +	int ret;
>  
>  	if (cp) {
>  		cp->id = LSM_ID_SELINUX;
Paul Moore Nov. 5, 2024, 10:05 p.m. UTC | #2
On Sat, Nov 2, 2024 at 5:31 AM Dan Carpenter <dan.carpenter@linaro.org> wrote:
>
> The "ret" variable needs to be signed for the error checking to work.
>
> Fixes: 95a3c11eb670 ("lsm: replace context+len with lsm_context")
> Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
> ---
>  security/selinux/hooks.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Merged into lsm/dev-staging, thanks Dan.
diff mbox series

Patch

diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c
index eca9674c9478..0ff018f557ac 100644
--- a/security/selinux/hooks.c
+++ b/security/selinux/hooks.c
@@ -6644,7 +6644,7 @@  static int selinux_ismaclabel(const char *name)
 static int selinux_secid_to_secctx(u32 secid, struct lsm_context *cp)
 {
 	u32 seclen;
-	u32 ret;
+	int ret;
 
 	if (cp) {
 		cp->id = LSM_ID_SELINUX;