From f4c6912c95ed5d5bb08e1b07b9588876595ecdbd Mon Sep 17 00:00:00 2001 From: Jan Beulich Date: Fri, 14 Mar 2014 17:45:14 +0100 Subject: [PATCH] x86/MSI: don't risk division by zero 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 Signed-off-by: Jan Beulich Reviewed-by: Boris Ostrovsky master commit: 5d160d913e03b581bdddde73535c18ac670cf0a9 master date: 2014-02-24 12:11:01 +0100 --- xen/arch/x86/msi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xen/arch/x86/msi.c b/xen/arch/x86/msi.c index 5da04101c9..4d98fd174d 100644 --- a/xen/arch/x86/msi.c +++ b/xen/arch/x86/msi.c @@ -597,7 +597,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 ) { -- 2.39.5