Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp2293732imu; Thu, 10 Jan 2019 11:32:33 -0800 (PST) X-Google-Smtp-Source: ALg8bN7iGcU7PgWajbXHkaNVHG+5PRQkWLJE7E6HB0kjb2Cw8bnrmR3dnKkgIvMErO9q+tqZWk16 X-Received: by 2002:a63:bf0b:: with SMTP id v11mr458582pgf.302.1547148753356; Thu, 10 Jan 2019 11:32:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547148753; cv=none; d=google.com; s=arc-20160816; b=kFQHxuO8WhC8YrGxFuivhK4ecUgQX83ci0UAEW5m3V1kVk82XterA6bQQLli4nvgIS oOZpFN0pqQF1osFQxEZTVC/iWP7D9qwNf2EYRSo2xpwtd2WdKP9gdq1ubOKpNFwKhphJ 5SX6BU0yBBjRgTo9Q+YwrHLn6sdB3OLtFIJNAgVotzKThSfwT2zdTyz2I3N8gCJktRIl 5A9XlEZyyI+fhf85Bw9Ix+r9B4X1vwqfb0/iYF6kuCDlGDD4HLvbOl9RQ1NJcIUKfBkb 3geSb5NU2zWQ21w0YBAVng8ZX/t/eqkfbH0EFu7+ySdC0Cw2jOSDUEMOOnPGK2Hi1K8y 6C3A== 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=yunOxm7f641ArikQSrc8dqmBdmRcvehu5Wg1kzPhb0o=; b=bCR7wI0P+a8z5qFBbykKKqnRp7b/62It0U1KLRyIP2qycnpOx+2u2s0w03UrXwDo88 CW+5TqZs9F9GDNkiFwi5j6ICt4C+zolSsBkHZb+AWGKCEQM06tk2iuCftnnxszYZuonU pJtMFUP+gH0DG6TbhO4/5hHYFbY6GUtgEj9mKNDJP69wGJqkoq7xJuTQ2l6STAD8gc1B 3w3YTPM665aEtFV2th6Qo1LknuM7rUQapFHbevARberZAdXLHNjI/0KmBjULS+B1hgZR 2UKSHiB3GASxqGVHbgs0WEsEj4hsWexRXcaQej6Rhi5MChNzn0ET1lbQJQnxoSPM31eI xs9w== 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 v13si25890240pgn.355.2019.01.10.11.32.16; Thu, 10 Jan 2019 11:32:33 -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 S1729068AbfAJNta (ORCPT + 99 others); Thu, 10 Jan 2019 08:49:30 -0500 Received: from mx08-00178001.pphosted.com ([91.207.212.93]:45158 "EHLO mx07-00178001.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1729010AbfAJNt1 (ORCPT ); Thu, 10 Jan 2019 08:49:27 -0500 Received: from pps.filterd (m0046661.ppops.net [127.0.0.1]) by mx08-00178001.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x0ADf3oF008201; Thu, 10 Jan 2019 14:49:22 +0100 Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by mx08-00178001.pphosted.com with ESMTP id 2ptvjg2ptn-1 (version=TLSv1 cipher=ECDHE-RSA-AES256-SHA bits=256 verify=NOT); Thu, 10 Jan 2019 14:49:22 +0100 Received: from zeta.dmz-eu.st.com (zeta.dmz-eu.st.com [164.129.230.9]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id AA93234; Thu, 10 Jan 2019 13:49:21 +0000 (GMT) Received: from Webmail-eu.st.com (Safex1hubcas22.st.com [10.75.90.92]) by zeta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 8A08A504C; Thu, 10 Jan 2019 13:49:21 +0000 (GMT) Received: from SAFEX1HUBCAS21.st.com (10.75.90.45) by Safex1hubcas22.st.com (10.75.90.92) with Microsoft SMTP Server (TLS) id 14.3.361.1; Thu, 10 Jan 2019 14:49:21 +0100 Received: from localhost (10.201.20.178) by Webmail-ga.st.com (10.75.90.48) with Microsoft SMTP Server (TLS) id 14.3.361.1; Thu, 10 Jan 2019 14:49:20 +0100 From: Loic Pallardy To: , CC: , , , , , Loic Pallardy Subject: [PATCH v2 2/7] remoteproc: fix rproc_da_to_va in case of unallocated carveout Date: Thu, 10 Jan 2019 14:49:06 +0100 Message-ID: <1547128151-44077-3-git-send-email-loic.pallardy@st.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1547128151-44077-1-git-send-email-loic.pallardy@st.com> References: <1547128151-44077-1-git-send-email-loic.pallardy@st.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.201.20.178] X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2019-01-10_05:,, signatures=0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org With introduction of rproc_alloc_registered_carveouts() which delays carveout allocation just before the start of the remote processor, rproc_da_to_va() could be called before all carveouts are allocated. This patch adds a check in rproc_da_to_va() to return NULL if carveout is not allocated. Fixes: d7c51706d095 ("remoteproc: add alloc ops in rproc_mem_entry struct") Signed-off-by: Loic Pallardy --- drivers/remoteproc/remoteproc_core.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/remoteproc/remoteproc_core.c b/drivers/remoteproc/remoteproc_core.c index c1a66e25b173..28df71cb3fef 100644 --- a/drivers/remoteproc/remoteproc_core.c +++ b/drivers/remoteproc/remoteproc_core.c @@ -204,6 +204,10 @@ void *rproc_da_to_va(struct rproc *rproc, u64 da, int len) list_for_each_entry(carveout, &rproc->carveouts, node) { int offset = da - carveout->da; + /* Verify that carveout is allocated */ + if (!carveout->va) + continue; + /* try next carveout if da is too small */ if (offset < 0) continue; -- 2.7.4