@@ -317,14 +317,14 @@ static int vfio_msi_enable(struct vfio_pci_core_device *vdev, int nvec, bool msi
317
317
}
318
318
319
319
static int vfio_msi_set_vector_signal (struct vfio_pci_core_device * vdev ,
320
- int vector , int fd , bool msix )
320
+ unsigned int vector , int fd , bool msix )
321
321
{
322
322
struct pci_dev * pdev = vdev -> pdev ;
323
323
struct eventfd_ctx * trigger ;
324
324
int irq , ret ;
325
325
u16 cmd ;
326
326
327
- if (vector < 0 || vector >= vdev -> num_ctx )
327
+ if (vector >= vdev -> num_ctx )
328
328
return - EINVAL ;
329
329
330
330
irq = pci_irq_vector (pdev , vector );
@@ -399,7 +399,8 @@ static int vfio_msi_set_vector_signal(struct vfio_pci_core_device *vdev,
399
399
static int vfio_msi_set_block (struct vfio_pci_core_device * vdev , unsigned start ,
400
400
unsigned count , int32_t * fds , bool msix )
401
401
{
402
- int i , j , ret = 0 ;
402
+ unsigned int i , j ;
403
+ int ret = 0 ;
403
404
404
405
if (start >= vdev -> num_ctx || start + count > vdev -> num_ctx )
405
406
return - EINVAL ;
@@ -410,8 +411,8 @@ static int vfio_msi_set_block(struct vfio_pci_core_device *vdev, unsigned start,
410
411
}
411
412
412
413
if (ret ) {
413
- for (-- j ; j >= ( int ) start ; j -- )
414
- vfio_msi_set_vector_signal (vdev , j , -1 , msix );
414
+ for (i = start ; i < j ; i ++ )
415
+ vfio_msi_set_vector_signal (vdev , i , -1 , msix );
415
416
}
416
417
417
418
return ret ;
@@ -420,7 +421,7 @@ static int vfio_msi_set_block(struct vfio_pci_core_device *vdev, unsigned start,
420
421
static void vfio_msi_disable (struct vfio_pci_core_device * vdev , bool msix )
421
422
{
422
423
struct pci_dev * pdev = vdev -> pdev ;
423
- int i ;
424
+ unsigned int i ;
424
425
u16 cmd ;
425
426
426
427
for (i = 0 ; i < vdev -> num_ctx ; i ++ ) {
@@ -542,7 +543,7 @@ static int vfio_pci_set_msi_trigger(struct vfio_pci_core_device *vdev,
542
543
unsigned index , unsigned start ,
543
544
unsigned count , uint32_t flags , void * data )
544
545
{
545
- int i ;
546
+ unsigned int i ;
546
547
bool msix = (index == VFIO_PCI_MSIX_IRQ_INDEX ) ? true : false;
547
548
548
549
if (irq_is (vdev , index ) && !count && (flags & VFIO_IRQ_SET_DATA_NONE )) {
0 commit comments