* [PATCH] gnttab: fix out of range shift count
@ 2015-06-17 15:26 Jan Beulich
2015-06-17 15:27 ` Andrew Cooper
0 siblings, 1 reply; 2+ messages in thread
From: Jan Beulich @ 2015-06-17 15:26 UTC (permalink / raw)
To: xen-devel
Cc: Ian Campbell, Andrew Cooper, Keir Fraser, Ian Jackson, Tim Deegan
[-- Attachment #1: Type: text/plain, Size: 706 bytes --]
Commit 213f145114 ("gnttab: fix/adjust gnttab_transfer()") wasn't
careful enough in this regard.
Coverity ID: 1306859
Signed-off-by: Jan Beulich <jbeulich@suse.com>
--- a/xen/common/grant_table.c
+++ b/xen/common/grant_table.c
@@ -1726,7 +1726,8 @@ gnttab_transfer(
max_bitsize = domain_clamp_alloc_bitsize(
e, e->grant_table->gt_version > 1 || paging_mode_translate(e)
? BITS_PER_LONG + PAGE_SHIFT : 32 + PAGE_SHIFT);
- if ( (1UL << (max_bitsize - PAGE_SHIFT)) <= mfn )
+ if ( max_bitsize < BITS_PER_LONG + PAGE_SHIFT &&
+ (mfn >> (max_bitsize - PAGE_SHIFT)) )
{
struct page_info *new_page;
[-- Attachment #2: gnttab-transfer-shift-count.patch --]
[-- Type: text/plain, Size: 740 bytes --]
gnttab: fix out of range shift count
Commit 213f145114 ("gnttab: fix/adjust gnttab_transfer()") wasn't
careful enough in this regard.
Coverity ID: 1306859
Signed-off-by: Jan Beulich <jbeulich@suse.com>
--- a/xen/common/grant_table.c
+++ b/xen/common/grant_table.c
@@ -1726,7 +1726,8 @@ gnttab_transfer(
max_bitsize = domain_clamp_alloc_bitsize(
e, e->grant_table->gt_version > 1 || paging_mode_translate(e)
? BITS_PER_LONG + PAGE_SHIFT : 32 + PAGE_SHIFT);
- if ( (1UL << (max_bitsize - PAGE_SHIFT)) <= mfn )
+ if ( max_bitsize < BITS_PER_LONG + PAGE_SHIFT &&
+ (mfn >> (max_bitsize - PAGE_SHIFT)) )
{
struct page_info *new_page;
[-- Attachment #3: Type: text/plain, Size: 126 bytes --]
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: [PATCH] gnttab: fix out of range shift count
2015-06-17 15:26 [PATCH] gnttab: fix out of range shift count Jan Beulich
@ 2015-06-17 15:27 ` Andrew Cooper
0 siblings, 0 replies; 2+ messages in thread
From: Andrew Cooper @ 2015-06-17 15:27 UTC (permalink / raw)
To: Jan Beulich, xen-devel; +Cc: Ian Campbell, Keir Fraser, Ian Jackson, Tim Deegan
On 17/06/15 16:26, Jan Beulich wrote:
> Commit 213f145114 ("gnttab: fix/adjust gnttab_transfer()") wasn't
> careful enough in this regard.
>
> Coverity ID: 1306859
> Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
>
> --- a/xen/common/grant_table.c
> +++ b/xen/common/grant_table.c
> @@ -1726,7 +1726,8 @@ gnttab_transfer(
> max_bitsize = domain_clamp_alloc_bitsize(
> e, e->grant_table->gt_version > 1 || paging_mode_translate(e)
> ? BITS_PER_LONG + PAGE_SHIFT : 32 + PAGE_SHIFT);
> - if ( (1UL << (max_bitsize - PAGE_SHIFT)) <= mfn )
> + if ( max_bitsize < BITS_PER_LONG + PAGE_SHIFT &&
> + (mfn >> (max_bitsize - PAGE_SHIFT)) )
> {
> struct page_info *new_page;
>
>
>
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-06-17 15:28 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-06-17 15:26 [PATCH] gnttab: fix out of range shift count Jan Beulich
2015-06-17 15:27 ` Andrew Cooper
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.