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 57E34A00BE; Thu, 10 Feb 2022 16:12:50 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 4184842721; Thu, 10 Feb 2022 16:12:50 +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 6CE9D426EE for ; Thu, 10 Feb 2022 16:12:48 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1644505968; 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=Zwkcqbjkrg37T7t9lxbDSYqgJqTeMQgj66EAMDYaU3U=; b=YGaMoG63hOnzE0/MFrEx4HldAT1AY6yqVjPFw+bBY+bot3lfUyWdJn6TyJOHan2Jd4LJbi xNbRgnpo3PS6mxpVpfqZoIpkvq98hzEFlnODg9qhJN19u83iBtbsXnrdH4QrOx6F5j57lm jSqzqNQaM9ofg6pCZbtkdig2kE/ycmM= 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-25-wVGAWlRZPj-vzPw4e1fisw-1; Thu, 10 Feb 2022 10:12:46 -0500 X-MC-Unique: wVGAWlRZPj-vzPw4e1fisw-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id C23D3802925; Thu, 10 Feb 2022 15:12:45 +0000 (UTC) Received: from [10.39.208.19] (unknown [10.39.208.19]) by smtp.corp.redhat.com (Postfix) with ESMTPS id BD08978AAC; Thu, 10 Feb 2022 15:12:42 +0000 (UTC) Message-ID: <906ae5ff-106e-4a91-af6c-47431b956561@redhat.com> Date: Thu, 10 Feb 2022 16:12:41 +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.79 on 10.5.11.14 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. Thanks, Maxime