[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [xen staging-4.12] x86/hvm: Fix shifting in stdvga_mem_read()
commit f769c99f923d0bba81626f4b50bb1e2ebc5ec9b9 Author: Andrew Cooper <andrew.cooper3@xxxxxxxxxx> AuthorDate: Wed Jun 24 17:00:33 2020 +0200 Commit: Jan Beulich <jbeulich@xxxxxxxx> CommitDate: Wed Jun 24 17:00:33 2020 +0200 x86/hvm: Fix shifting in stdvga_mem_read() stdvga_mem_read() has a return type of uint8_t, which promotes to int rather than unsigned int. Shifting by 24 may hit the sign bit. Spotted by Coverity. Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx> Reviewed-by: Jan Beulich <jbeulich@xxxxxxxx> master commit: 97fb0253e6c2f2221bfd0895b7ffe3a99330d847 master date: 2020-05-18 15:22:53 +0100 --- xen/arch/x86/hvm/stdvga.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xen/arch/x86/hvm/stdvga.c b/xen/arch/x86/hvm/stdvga.c index bd398dbb1b..e2675139e7 100644 --- a/xen/arch/x86/hvm/stdvga.c +++ b/xen/arch/x86/hvm/stdvga.c @@ -322,7 +322,7 @@ static int stdvga_mem_read(const struct hvm_io_handler *handler, data = stdvga_mem_readb(addr); data |= stdvga_mem_readb(addr + 1) << 8; data |= stdvga_mem_readb(addr + 2) << 16; - data |= stdvga_mem_readb(addr + 3) << 24; + data |= (uint32_t)stdvga_mem_readb(addr + 3) << 24; break; case 8: -- generated by git-patchbot for /home/xen/git/xen.git#staging-4.12
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |