mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Serge E. Hallyn" <serge@hallyn.com>
To: Vasyl Gomonovych <gomonovych@gmail.com>
Cc: zohar@linux.vnet.ibm.com, dmitry.kasatkin@gmail.com,
	james.l.morris@oracle.com, serge@hallyn.com,
	linux-integrity@vger.kernel.org,
	linux-security-module@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] ima: Fix warn potential negative subtraction from max
Date: Thu, 21 Dec 2017 12:00:01 -0600	[thread overview]
Message-ID: <20171221180001.GC16008@mail.hallyn.com> (raw)
In-Reply-To: <1513871754-13943-1-git-send-email-gomonovych@gmail.com>

Quoting Vasyl Gomonovych (gomonovych@gmail.com):
> Found by smatch:
> security/integrity/ima/ima_queue.c:122 ima_add_digest_entry() warn:
> potential negative subtraction from max '(~0)- size'
> 
> Signed-off-by: Vasyl Gomonovych <gomonovych@gmail.com>
> ---
>  security/integrity/ima/ima_queue.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/security/integrity/ima/ima_queue.c b/security/integrity/ima/ima_queue.c
> index a02a86d51102..446018478b81 100644
> --- a/security/integrity/ima/ima_queue.c
> +++ b/security/integrity/ima/ima_queue.c
> @@ -116,7 +116,7 @@ static int ima_add_digest_entry(struct ima_template_entry *entry,
>  	}
>  
>  	if (binary_runtime_size != ULONG_MAX) {
> -		int size;
> +		unsigned int size;

Hm, but get_binary_runtime_size() returns an int.

>  
>  		size = get_binary_runtime_size(entry);
>  		binary_runtime_size = (binary_runtime_size < ULONG_MAX - size) ?
> -- 
> 1.9.1

  reply	other threads:[~2017-12-21 18:00 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-21 15:55 Vasyl Gomonovych
2017-12-21 18:00 ` Serge E. Hallyn [this message]
2017-12-21 21:54   ` [PATCH v2] " Vasyl Gomonovych

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=20171221180001.GC16008@mail.hallyn.com \
    --to=serge@hallyn.com \
    --cc=dmitry.kasatkin@gmail.com \
    --cc=gomonovych@gmail.com \
    --cc=james.l.morris@oracle.com \
    --cc=linux-integrity@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-security-module@vger.kernel.org \
    --cc=zohar@linux.vnet.ibm.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®