From: Matthew Daley <mattjd@gmail.com>
To: xen-devel@lists.xen.org
Cc: Matthew Daley <mattjd@gmail.com>
Subject: [PATCH] xen: Fix xenctl_cpumap_to_cpumask buffer size check
Date: Tue, 13 Nov 2012 19:04:47 +1300 [thread overview]
Message-ID: <1352786687-4498-1-git-send-email-mattjd@gmail.com> (raw)
xenctl_cpumap_to_cpumask incorrectly uses sizeof when checking whether
bits should be masked off from the input cpumap bitmap or not.
Fix by using the correct cpumask buffer size in place of sizeof.
Signed-off-by: Matthew Daley <mattjd@gmail.com>
diff --git a/xen/common/domctl.c b/xen/common/domctl.c
index e153cb4..204e951 100644
--- a/xen/common/domctl.c
+++ b/xen/common/domctl.c
@@ -78,7 +78,7 @@ int xenctl_cpumap_to_cpumask(
{
if ( copy_from_guest(bytemap, xenctl_cpumap->bitmap, copy_bytes) )
err = -EFAULT;
- if ( (xenctl_cpumap->nr_cpus & 7) && (guest_bytes <= sizeof(bytemap)) )
+ if ( (xenctl_cpumap->nr_cpus & 7) && (guest_bytes <= (nr_cpu_ids + 7) / 8) )
bytemap[guest_bytes-1] &= ~(0xff << (xenctl_cpumap->nr_cpus & 7));
}
--
1.7.10.4
next reply other threads:[~2012-11-13 6:04 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-11-13 6:04 Matthew Daley [this message]
2012-11-13 8:36 ` [PATCH] xen: Fix xenctl_cpumap_to_cpumask buffer size check Jan Beulich
2012-11-13 10:10 ` Keir Fraser
2012-11-13 10:17 ` Matthew Daley
2012-11-13 10:58 ` Keir Fraser
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=1352786687-4498-1-git-send-email-mattjd@gmail.com \
--to=mattjd@gmail.com \
--cc=xen-devel@lists.xen.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;
as well as URLs for NNTP newsgroup(s).