|
|
|
|
|
|
|
|
|
|
xen-devel
[Xen-devel] [PATCH] fix undefined bit shifting in mmio emulation path
In functions set_eflags_* (xen/arch/x86/hvm/io.c), if the first argument
"size" equals sizeof(long), the following code will produce unintended
and invalid result:
unsigned long mask = (1 << (8 * size)) - 1;
In ANSI C, if the shift amount is greater or equal to the width of the
data type, the result is undefined. Specifically on x86, a bit mask is
applied to the shift amount, so that more significant bits are ignored.
So the above expression results 0x0 instead of the intended ~0UL.
This patch fixes this issue. Because size=0 is not a valid parameter,
rewriting the code using right shift avoids an additional condition
check.
Signed-off-by: Qing He <qing.he@xxxxxxxxx>
mmio_instr_emu_safe_shift.patch
Description: mmio_instr_emu_safe_shift.patch
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
|
<Prev in Thread] |
Current Thread |
[Next in Thread> |
- [Xen-devel] [PATCH] fix undefined bit shifting in mmio emulation path,
He, Qing <=
|
|
|
|
|