From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id C538FA00BE; Thu, 10 Feb 2022 16:11:26 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 619E742714; Thu, 10 Feb 2022 16:11:26 +0100 (CET) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mails.dpdk.org (Postfix) with ESMTP id 2D8B1426EE for ; Thu, 10 Feb 2022 16:11:24 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1644505883; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=PYLDxHfWvpNsNuRxmeoemXa0F20SbaYrpPKdbRPVLHo=; b=gvLvIJTU3BquT6OteDOc34JQaMSUFEes7sQYNBKc74qfDcDxcL9F2lBsETjT7tEi79YeQS GO7xsRQSTFyrHOwYp0iRQRPqfIta3NwoK651sLOJmyPVj1lpyBBnU+a8u+mq74OMpu7SCD S7lHqHW6zi2BRSs6DVHXpLeqqhmZ32g= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-9-N0AdBXPdPSSaMyhkQlrDRg-1; Thu, 10 Feb 2022 10:11:22 -0500 X-MC-Unique: N0AdBXPdPSSaMyhkQlrDRg-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 28CD046865; Thu, 10 Feb 2022 15:11:21 +0000 (UTC) Received: from [10.39.208.19] (unknown [10.39.208.19]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 3BE55105B1F0; Thu, 10 Feb 2022 15:11:19 +0000 (UTC) Message-ID: <03df02cf-be89-a160-81df-303661597359@redhat.com> Date: Thu, 10 Feb 2022 16:11:18 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.5.0 Subject: Re: [PATCH] vdpa/sfc: fix null pointer dereference To: Weiguo Li , vsrivast@xilinx.com Cc: dev@dpdk.org References: From: Maxime Coquelin In-Reply-To: X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=maxime.coquelin@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org On 1/29/22 18:30, Weiguo Li wrote: > When sva is null, sfc_vdpa_info(sva, ...) will cause a null > dereference. Use SFC_VDPA_GENERIC_LOG() to avoid that. > See macros sfc_vdpa_info and SFC_VDPA_GENERIC_LOG > defined in drivers/vdpa/sfc/sfc_vdpa_log.h for detail. > > Fixes: 5e7596ba7cb3 ("vdpa/sfc: introduce Xilinx vDPA driver") > > Signed-off-by: Weiguo Li > --- > drivers/vdpa/sfc/sfc_vdpa.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/drivers/vdpa/sfc/sfc_vdpa.c b/drivers/vdpa/sfc/sfc_vdpa.c > index fccdd8c687..53f598facc 100644 > --- a/drivers/vdpa/sfc/sfc_vdpa.c > +++ b/drivers/vdpa/sfc/sfc_vdpa.c > @@ -328,7 +328,8 @@ sfc_vdpa_pci_remove(struct rte_pci_device *pci_dev) > > sva = sfc_vdpa_get_adapter_by_dev(pci_dev); > if (sva == NULL) { > - sfc_vdpa_info(sva, "invalid device: %s", pci_dev->name); > + SFC_VDPA_GENERIC_LOG(INFO, > + "Invalid device: %s.", pci_dev->name); > return -1; > } > Applied to dpdk-next-virtio/main, with rewording the title and cc'ing stable. Thanks, Maxime