commit 6a024330650e24556b8a18cc654ad00cfecf6c6c upstream.
The "param.count" value is a u64 thatcomes from the user. The code
later in the function assumes that param.count is at least one and if
it's not then it leads to an Oops when we dereference the ZERO_SIZE_PTR.
Also the addition can have an integer overflow which would lead us to
allocate a smaller "pages" array than required. I can't immediately
tell what the possible run times implications are, but it's safest to
prevent the overflow.
Fixes: 6db71994 ("drivers/virt: introduce Freescale hypervisor management driver")
Signed-off-by: Dan Carpenter <firstname.lastname@example.org>
Reviewed-by: Andrew Morton <email@example.com>
Cc: Timur Tabi <firstname.lastname@example.org>
Cc: Mihai Caraman <email@example.com>
Cc: Kumar Gala <firstname.lastname@example.org>
Signed-off-by: Andrew Morton <email@example.com>
Signed-off-by: Linus Torvalds <firstname.lastname@example.org>
Signed-off-by: Greg Kroah-Hartman <email@example.com>