From: Sergio Gonzalez Monroy Subject: Re: [PATCH] vfio: do not use memcmp() to compare PCI address Date: Fri, 31 Mar 2017 17:09:37 +0100 Message-ID: References: <1490975813-6700-1-git-send-email-arybchenko@solarflare.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Cc: Anatoly Burakov , stable@dpdk.org, dev@dpdk.org To: Andrew Rybchenko Return-path: In-Reply-To: <1490975813-6700-1-git-send-email-arybchenko@solarflare.com> List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" On 31/03/2017 16:56, Andrew Rybchenko wrote: > PCI address structure has padding which may have garbage. > > Fixes: 2f4adfad0a69 ("vfio: add multiprocess support") > Cc: stable@dpdk.org > > Signed-off-by: Andrew Rybchenko > --- > It is a real bug which I've hit during multi-process debugging. > > lib/librte_eal/linuxapp/eal/eal_pci_vfio.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/lib/librte_eal/linuxapp/eal/eal_pci_vfio.c b/lib/librte_eal/linuxapp/eal/eal_pci_vfio.c > index 5f478c5..7d8b9fb 100644 > --- a/lib/librte_eal/linuxapp/eal/eal_pci_vfio.c > +++ b/lib/librte_eal/linuxapp/eal/eal_pci_vfio.c > @@ -355,7 +355,8 @@ pci_vfio_map_resource(struct rte_pci_device *dev) > } else { > /* if we're in a secondary process, just find our tailq entry */ > TAILQ_FOREACH(vfio_res, vfio_res_list, next) { > - if (memcmp(&vfio_res->pci_addr, &dev->addr, sizeof(dev->addr))) > + if (rte_eal_compare_pci_addr(&vfio_res->pci_addr, > + &dev->addr)) > continue; > break; > } Different commit, same patch :) http://dpdk.org/dev/patchwork/patch/21828/ Regards, Sergio