Skip to content

Commit aab439f

Browse files
Dan Carpenterawilliam
authored andcommitted
vfio/pci: clean up a type in vfio_pci_ioctl_pci_hot_reset_groups()
The "array_count" value comes from the copy_from_user() in vfio_pci_ioctl_pci_hot_reset(). If the user passes a value larger than INT_MAX then we'll pass a negative value to kcalloc() which triggers an allocation failure and a stack trace. It's better to make the type unsigned so that if (array_count > count) returns -EINVAL instead. Signed-off-by: Dan Carpenter <[email protected]> Reviewed-by: Jason Gunthorpe <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Alex Williamson <[email protected]>
1 parent 27a8204 commit aab439f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/vfio/pci/vfio_pci_core.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1323,7 +1323,7 @@ static int vfio_pci_ioctl_get_pci_hot_reset_info(
13231323

13241324
static int
13251325
vfio_pci_ioctl_pci_hot_reset_groups(struct vfio_pci_core_device *vdev,
1326-
int array_count, bool slot,
1326+
u32 array_count, bool slot,
13271327
struct vfio_pci_hot_reset __user *arg)
13281328
{
13291329
int32_t *group_fds;

0 commit comments

Comments
 (0)