All of lore.kernel.org
 help / color / mirror / Atom feed
From: John Johansen <john.johansen@canonical.com>
To: linux-security-module@vger.kernel.org
Subject: Re: [PATCH] apparmor: Fix harmless off by one in map_signal_num()
Date: Mon, 25 Sep 2017 14:25:01 +0000	[thread overview]
Message-ID: <d2c82d40-2b1b-163d-85d3-4a902f62e818@canonical.com> (raw)
In-Reply-To: <20170901085225.dpuirzpj7aq3yyim@mwanda>

On 09/01/2017 04:52 AM, Dan Carpenter wrote:
> This patch has no effect on runtime.
> 
> The sig_map[] array has MAXMAPPED_SIG (35) members so my static checker
> complains that the <= should be <.  But in this case it's not possible
> for "sig" to be more than 31 because of the "else if (sig >= SIGRTMIN)"
> condition since SIGRTMIN is 32.  The last three elements, 32-34, of
> sig_map[] are empty so this code works as designed.
> 
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> 
> diff --git a/security/apparmor/ipc.c b/security/apparmor/ipc.c
> index 66fb9ede9447..5091c78062e4 100644
> --- a/security/apparmor/ipc.c
> +++ b/security/apparmor/ipc.c
> @@ -128,7 +128,7 @@ static inline int map_signal_num(int sig)
>  		return SIGUNKNOWN;
>  	else if (sig >= SIGRTMIN)
>  		return sig - SIGRTMIN + 128;	/* rt sigs mapped to 128 */
> -	else if (sig <= MAXMAPPED_SIG)
> +	else if (sig < MAXMAPPED_SIG)
>  		return sig_map[sig];
>  	return SIGUNKNOWN;
>  }
> 

Colin King beat you to this one, its in apparmor-next

WARNING: multiple messages have this Message-ID (diff)
From: john.johansen@canonical.com (John Johansen)
To: linux-security-module@vger.kernel.org
Subject: [PATCH] apparmor: Fix harmless off by one in map_signal_num()
Date: Mon, 25 Sep 2017 10:25:01 -0400	[thread overview]
Message-ID: <d2c82d40-2b1b-163d-85d3-4a902f62e818@canonical.com> (raw)
In-Reply-To: <20170901085225.dpuirzpj7aq3yyim@mwanda>

On 09/01/2017 04:52 AM, Dan Carpenter wrote:
> This patch has no effect on runtime.
> 
> The sig_map[] array has MAXMAPPED_SIG (35) members so my static checker
> complains that the <= should be <.  But in this case it's not possible
> for "sig" to be more than 31 because of the "else if (sig >= SIGRTMIN)"
> condition since SIGRTMIN is 32.  The last three elements, 32-34, of
> sig_map[] are empty so this code works as designed.
> 
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> 
> diff --git a/security/apparmor/ipc.c b/security/apparmor/ipc.c
> index 66fb9ede9447..5091c78062e4 100644
> --- a/security/apparmor/ipc.c
> +++ b/security/apparmor/ipc.c
> @@ -128,7 +128,7 @@ static inline int map_signal_num(int sig)
>  		return SIGUNKNOWN;
>  	else if (sig >= SIGRTMIN)
>  		return sig - SIGRTMIN + 128;	/* rt sigs mapped to 128 */
> -	else if (sig <= MAXMAPPED_SIG)
> +	else if (sig < MAXMAPPED_SIG)
>  		return sig_map[sig];
>  	return SIGUNKNOWN;
>  }
> 

Colin King beat you to this one, its in apparmor-next
--
To unsubscribe from this list: send the line "unsubscribe linux-security-module" in
the body of a message to majordomo at vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  reply	other threads:[~2017-09-25 14:25 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-01  8:52 [PATCH] apparmor: Fix harmless off by one in map_signal_num() Dan Carpenter
2017-09-01  8:52 ` Dan Carpenter
2017-09-25 14:25 ` John Johansen [this message]
2017-09-25 14:25   ` John Johansen
2017-09-25 15:09   ` Dan Carpenter
2017-09-25 15:09     ` Dan Carpenter
2017-09-25 16:27     ` John Johansen
2017-09-25 16:27       ` John Johansen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=d2c82d40-2b1b-163d-85d3-4a902f62e818@canonical.com \
    --to=john.johansen@canonical.com \
    --cc=linux-security-module@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.