qemu-block
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-block] [PATCH v3 0/2] block: vpc - prevent overflow


From: Kevin Wolf
Subject: Re: [Qemu-block] [PATCH v3 0/2] block: vpc - prevent overflow
Date: Fri, 24 Jul 2015 17:59:49 +0200
User-agent: Mutt/1.5.21 (2010-09-15)

Am 24.07.2015 um 16:26 hat Jeff Cody geschrieben:
> Changes:
> 
> v3: check for INT_MAX / 4 as well, and use ROUND_UP (Thanks Max)
> 
> v2 now also checks that Max Table Entries is < SIZE_MAX / 4 (Thanks Stefan)
> 
> This series fixes a bug found by Richard Jones.
> 
> When we allocate the pagetable based on max_table_entries, we multiply
> the max table entry value by 4 to accomodate a table of 32-bit integers.
> However, max_table_entries is a uint32_t, and the VPC driver accepts
> ranges for that entry over 0x40000000.  So during this allocation:
> 
> s->pagetable = qemu_try_blockalign(bs->file, s->max_table_entries * 4);
> 
> The size arg overflows, allocating significantly less memory than
> expected.
> 
> Since qemu_try_blockalign() size argument is size_t, cast the
> multiplication correctly to prevent overflow.
> 
> The value of "max_table_entries * 4" is used elsewhere in the code as
> well, so store the correct value for use in all those cases.

Thanks, applied to my block branch for 2.4.

When posting patches that are meant for qemu-stable, it's best to not
only copy the mailing list for the emails, but to have an explicit
"Cc: address@hidden" in the commit message. I added the tag
for this series while applying.

Kevin



reply via email to

[Prev in Thread] Current Thread [Next in Thread]