virtio: pci: Check virtio common config size
authorAndrew Scull <ascull@google.com>
Thu, 21 Apr 2022 16:11:03 +0000 (16:11 +0000)
committerTom Rini <trini@konsulko.com>
Tue, 3 May 2022 19:50:45 +0000 (15:50 -0400)
commitf2c1ef1b6dfe93e9912d5d5dfae1e527da511c3f
tree77e309d5c02e5ccfedf38223861f46ff9ccd8f37
parentc690f64f4c958531fb4bb1b1540931adba022830
virtio: pci: Check virtio common config size

Check that the common config is at least as large as the struct it is
expected to contain. Only then is it safe to cast the pointer and be
safe from out-of-bounds accesses.

Signed-off-by: Andrew Scull <ascull@google.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
drivers/virtio/virtio_pci_modern.c