vfio/pci: Init the count variable in collecting hot-reset devices
authorYi Liu <yi.l.liu@intel.com>
Wed, 10 Jul 2024 00:41:50 +0000 (17:41 -0700)
committerAlex Williamson <alex.williamson@redhat.com>
Wed, 10 Jul 2024 14:47:46 +0000 (08:47 -0600)
commit5a88a3f67e37e39f933b38ebb4985ba5822e9eca
treef505a10bc548779257f9d341e43984ae9c1b8405
parent256abd8e550ce977b728be79a74e1729438b4948
vfio/pci: Init the count variable in collecting hot-reset devices

The count variable is used without initialization, it results in mistakes
in the device counting and crashes the userspace if the get hot reset info
path is triggered.

Fixes: f6944d4a0b87 ("vfio/pci: Collect hot-reset devices to local buffer")
Link: https://bugzilla.kernel.org/show_bug.cgi?id=219010
Reported-by: Žilvinas Žaltiena <zaltys@natrix.lt>
Cc: Beld Zhang <beldzhang@gmail.com>
Signed-off-by: Yi Liu <yi.l.liu@intel.com>
Reviewed-by: Kevin Tian <kevin.tian@intel.com>
Reviewed-by: Jason Gunthorpe <jgg@nvidia.com>
Link: https://lore.kernel.org/r/20240710004150.319105-1-yi.l.liu@intel.com
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
drivers/vfio/pci/vfio_pci_core.c