x86/MSI: don't risk division by zero
authorJan Beulich <jbeulich@suse.com>
Mon, 24 Feb 2014 11:11:01 +0000 (12:11 +0100)
committerJan Beulich <jbeulich@suse.com>
Mon, 24 Feb 2014 11:11:01 +0000 (12:11 +0100)
The check in question is redundant with the one in the immediately
following if(), where dividing by zero gets carefully avoided.

Spotted-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
xen/arch/x86/msi.c

index 1aaceeb8f4ec9bd937e1f1cf9f1f8d6d64348bc8..61d6dd09d5231fc85d58a73abeeac810cd45b1f7 100644 (file)
@@ -636,7 +636,7 @@ static u64 read_pci_mem_bar(u16 seg, u8 bus, u8 slot, u8 func, u8 bir, int vf)
             return 0;
         base = pos + PCI_SRIOV_BAR;
         vf -= PCI_BDF(bus, slot, func) + offset;
-        if ( vf < 0 || (vf && vf % stride) )
+        if ( vf < 0 )
             return 0;
         if ( stride )
         {