From patchwork Tue Nov 12 09:30:56 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Garry X-Patchwork-Id: 179175 Delivered-To: patch@linaro.org Received: by 2002:a92:38d5:0:0:0:0:0 with SMTP id g82csp7855802ilf; Tue, 12 Nov 2019 01:34:38 -0800 (PST) X-Google-Smtp-Source: APXvYqy5NgACAy4C/0OnVl3XEtcTLGKwqml0Ky8qIIJBtBNSy84ed/bteTwzT//ZKkimczpcP6h5 X-Received: by 2002:a17:906:2e5a:: with SMTP id r26mr27563767eji.283.1573551278520; Tue, 12 Nov 2019 01:34:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573551278; cv=none; d=google.com; s=arc-20160816; b=obz6BpVhiGJw3Afpbv42/c1OLzQYCFqbJKlh1YG2xOqD7TDVZr52WojxiFEvmlOIyL WLrZx5kNx5QwCDZRwu2uIM+PcU0yg3FrLxTrr7WTHDQuOf3Ng/C9IvzY1i6eDPU8MW0Z x7yg2W8jcmfeH+oXnrsi79MFLgoyKWlepBRx7sFWGfX7jUM3280JzrbHoykBTE4qSLG0 iphqEkkzyD3iIH7E+Nenbh0lpr15gGQo78IsoUHMupsKIS1uph2xupVUlQUDRpJK+qMw z4A3r1kQaRgY2g4wzeYRn+ttAtSTUGryHLRMXjUccrCy9Wvtza7Ek1BpC23MN5RqlP0m +T7Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from; bh=MO1FMy8BjeQaur0n2iVe3jUqzM6VKKPrtIUvwhZIEiA=; b=GLMNWBT4+lLCQW7D9mGi/sonB5Q01O4AHhYoEMwSbqa+pD+s95yzUWWXD6d7/0vloQ NF55hKWsAUGpU2R3T4IkYx9fmnwKIqm9zGmsUmwsWkJnbJ5kYQz6OOFioEViv9jxZowW kF7fhntbrgS1swH/SKvEmVyKnEltDDXlFaLFFRlCiqy0Z6jkqdKI7t8kdtxxsI+HbmdU Yw02kRS++bNuhEYLJ+vQ9fSJGbwHf4WJInGZV333oXSYielsyDjxbLaPR0/XJqFPwtem 6LhlziusXpRuWbQdTxIxhRoyTy+I50zClZxuwzfVNW+qPybjBEsMHgVy0bTTId0VpsTg Wi6A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u3si7443133eja.201.2019.11.12.01.34.38; Tue, 12 Nov 2019 01:34:38 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727473AbfKLJef (ORCPT + 26 others); Tue, 12 Nov 2019 04:34:35 -0500 Received: from szxga05-in.huawei.com ([45.249.212.191]:6206 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727302AbfKLJe3 (ORCPT ); Tue, 12 Nov 2019 04:34:29 -0500 Received: from DGGEMS401-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id D3AB48A5A483CEA67AAB; Tue, 12 Nov 2019 17:34:24 +0800 (CST) Received: from localhost.localdomain (10.69.192.58) by DGGEMS401-HUB.china.huawei.com (10.3.19.201) with Microsoft SMTP Server id 14.3.439.0; Tue, 12 Nov 2019 17:34:18 +0800 From: John Garry To: , CC: , , , Xiang Chen , "John Garry" Subject: [PATCH 1/4] scsi: hisi_sas: Check sas_port before using it Date: Tue, 12 Nov 2019 17:30:56 +0800 Message-ID: <1573551059-107873-2-git-send-email-john.garry@huawei.com> X-Mailer: git-send-email 2.8.1 In-Reply-To: <1573551059-107873-1-git-send-email-john.garry@huawei.com> References: <1573551059-107873-1-git-send-email-john.garry@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.69.192.58] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Xiang Chen Need to check the structure sas_port before using it. Signed-off-by: Xiang Chen Signed-off-by: John Garry --- drivers/scsi/hisi_sas/hisi_sas_main.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) -- 2.17.1 diff --git a/drivers/scsi/hisi_sas/hisi_sas_main.c b/drivers/scsi/hisi_sas/hisi_sas_main.c index 18c95b33592b..c72fc59353bd 100644 --- a/drivers/scsi/hisi_sas/hisi_sas_main.c +++ b/drivers/scsi/hisi_sas/hisi_sas_main.c @@ -974,12 +974,13 @@ static void hisi_sas_port_notify_formed(struct asd_sas_phy *sas_phy) struct hisi_hba *hisi_hba = sas_ha->lldd_ha; struct hisi_sas_phy *phy = sas_phy->lldd_phy; struct asd_sas_port *sas_port = sas_phy->port; - struct hisi_sas_port *port = to_hisi_sas_port(sas_port); + struct hisi_sas_port *port; unsigned long flags; if (!sas_port) return; + port = to_hisi_sas_port(sas_port); spin_lock_irqsave(&hisi_hba->lock, flags); port->port_attached = 1; port->id = phy->port_id;