gnttab: fix out of range shift count
PATCH 1/1 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 <[email protected]>
xen/common/grant_table.c +2 -1
@@ -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;
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 <[email protected]>
xen/common/grant_table.c +2 -1
@@ -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;
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Quoted 5 lines · Jan Beulich
Commit
213f145114("gnttab: fix/adjustgnttab_transfer()") wasn't careful enough in this regard.Coverity ID: 1306859
Signed-off-by Jan Beulich <[email protected]>
Reviewed-by Andrew Cooper <[email protected]>
Quoted 16 lines
xen/common/grant_table.c +2
-1@@ -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;