From: Sasha Levin <sasha.levin@oracle.com>
To: mingo@kernel.org, akpm@linux-foundation.org,
torvalds@linux-foundation.org
Cc: linux-kernel@vger.kernel.org, Sasha Levin <sasha.levin@oracle.com>
Subject: [RFC 2/2] kvm: eventfd: detect integer overflow using check_*_overflow
Date: Wed, 26 Nov 2014 09:00:19 -0500 [thread overview]
Message-ID: <1417010419-3827-2-git-send-email-sasha.levin@oracle.com> (raw)
In-Reply-To: <1417010419-3827-1-git-send-email-sasha.levin@oracle.com>
Detect integer overflows using safe operations rather than relying on
undefined behaviour.
Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
---
virt/kvm/eventfd.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/virt/kvm/eventfd.c b/virt/kvm/eventfd.c
index 148b239..2eb044f 100644
--- a/virt/kvm/eventfd.c
+++ b/virt/kvm/eventfd.c
@@ -790,7 +790,7 @@ kvm_assign_ioeventfd(struct kvm *kvm, struct kvm_ioeventfd *args)
}
/* check for range overflow */
- if (args->addr + args->len < args->addr)
+ if (check_add_overflow(args->len, args->addr))
return -EINVAL;
/* check for extra flags that we don't understand */
--
1.7.10.4
next prev parent reply other threads:[~2014-11-26 14:00 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-11-26 14:00 [RFC 1/2] compiler: use compiler to detect integer overflows Sasha Levin
2014-11-26 14:00 ` Sasha Levin [this message]
2014-11-26 17:50 ` [RFC 2/2] kvm: eventfd: detect integer overflow using check_*_overflow Andrey Ryabinin
2014-11-26 17:55 ` Sasha Levin
2014-11-26 18:23 ` Linus Torvalds
2014-11-26 19:06 ` Sasha Levin
2014-11-26 19:12 ` Linus Torvalds
2014-11-26 19:27 ` Sasha Levin
2014-11-26 17:48 ` [RFC 1/2] compiler: use compiler to detect integer overflows Andrey Ryabinin
[not found] ` <CA+55aFzyDC=o_Beg+8hjW8+TQXYWCgQo_yfjgHsTz0LRTiomWA@mail.gmail.com>
2014-11-26 18:50 ` Sasha Levin
2014-11-26 18:58 ` Linus Torvalds
2014-11-27 20:42 ` Dan Carpenter
2014-12-05 9:54 ` Dan Carpenter
2014-12-05 18:50 ` Linus Torvalds
2014-12-05 19:39 ` Dan Carpenter
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=1417010419-3827-2-git-send-email-sasha.levin@oracle.com \
--to=sasha.levin@oracle.com \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=torvalds@linux-foundation.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 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®