From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.7 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_ADSP_CUSTOM_MED,DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4AF09C55ABD for ; Mon, 16 Nov 2020 08:45:18 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id D452522409 for ; Mon, 16 Nov 2020 08:45:17 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="uT0aruEK"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=google.com header.i=@google.com header.b="GXgOGre7" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D452522409 Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:To:From:Subject:References:Mime-Version:Message-Id: In-Reply-To:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=RcVA9N11TQHzo9GNBReShq/TcOuoWKzgQGGpALtk1po=; b=uT0aruEKgct4M8Ysz4wUbRw98 Acnho6YFhAskKpG4zYaz24iJebIluuoV35SHxl0hvPPYWI+/r0hT7j7RvCn+6uXDaxOBVLLpxEiNO lsX1mEHdGdOxvgBE0zFFgXfSkdS/1d/HCpzToMcoTFppXgvBeco12l1hN7C+GrH9ShOVlE94HsiF8 pe0/khHwqdnQzBQtAeD/vM9/2BUxkkSAJ+fBQbJJ5KCo6djG3oZ/dpsUmtwTYQaShlv2os5izBdBW pF4ecIkJ5/53vYgzZPVzss2ibKonhX3qRnMZOxCv22bAX+u6+NlTW9cR5yAlntl8y5pTE2NPakQAp Z/Tqm+tlg==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kea80-00042p-Hg; Mon, 16 Nov 2020 08:44:48 +0000 Received: from mail-qt1-x849.google.com ([2607:f8b0:4864:20::849]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kea7q-000404-Iv for linux-arm-kernel@lists.infradead.org; Mon, 16 Nov 2020 08:44:40 +0000 Received: by mail-qt1-x849.google.com with SMTP id i39so9722193qtb.1 for ; Mon, 16 Nov 2020 00:44:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=sender:date:in-reply-to:message-id:mime-version:references:subject :from:to:cc; bh=U1SYL24RcTv9N7iT3p8Gk3jg0reoXyBjPpMVxH+Yb2c=; b=GXgOGre7Vz7fMb34bNE5Fnr0Fuz4xu004X0MvPHy3/ZVL+bYlIvBjrV+j3YFiM1CTK mJkoYwcw3HaG/wFWu+8a8eNgFdyZ+lugSDUKxpy2+KE2NszFF0T4QCsaW2mRSU0o1cr0 L4JjnBcgjutYdsDlHwx8ar2SgdZzcFlAMC8payn3TF3SmxFFyMHRpVKYKwva/yq8awSr wVcZ3GEscUwsETAU+tAXkq1+65Jv1of7kB0ZGMYWCVf5FwPvBffxwIrF+WOJpVYS0v3R 7yr57qXUpXc/ywOqBLbco3E3QgGAYb4X9rQf2/4JaE+1hQFmMa8LP0vowZgbRmzD8ypy 08bw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=U1SYL24RcTv9N7iT3p8Gk3jg0reoXyBjPpMVxH+Yb2c=; b=dyeMtlFDomXSAMReQNb274zw85LgdQ0iobRMif9lZ/CrpxGx9M18jpqLCpNb5I+e15 HsUfJOnEcvQSLACedJJEMhN8ZTQsHGmf+2Xnlcudm2wPBqctprxB9fnqiJWhelZ628SH rxNVB2tMsDV2KTotAsIiGJCfA4dqy4CnsGWO8sRuj+IVJ/og0HdzbrgCGUXL3/HBvJi5 T36OHqHbRy84ulxSGjSSQpHoNfZLR2dd2pGaeA1Soug57K5oHSbgOurmOM1MeoNTvYUd yb8qcF9H2/V0djCB6/YYzOv3EIkmQp6rLG16OHJZJfLDpOta40Pb4CEaNDL1zRcUxRZR jnNw== X-Gm-Message-State: AOAM530ml4lLwKFrnSVA5mOP8SIq/cefw0pVM+EN8RVbOP5bkffNQkLo 1mNrXvQloAzKGZjuMdqfURYhkRspcXZN X-Google-Smtp-Source: ABdhPJzhbiY6OL3SEP4f5SvcBbQqzn20Wueip3Hg4YPjnhhPTZC1kw4E3QbluKfoOYm2U9VaaZ7MgAacn1oH X-Received: from tzungbi-z840.tpe.corp.google.com ([2401:fa00:1:b:725a:fff:fe41:c6a5]) (user=tzungbi job=sendgmr) by 2002:a0c:a8c4:: with SMTP id h4mr404502qvc.58.1605516275666; Mon, 16 Nov 2020 00:44:35 -0800 (PST) Date: Mon, 16 Nov 2020 16:44:11 +0800 In-Reply-To: <20201116084413.3312631-1-tzungbi@google.com> Message-Id: <20201116084413.3312631-2-tzungbi@google.com> Mime-Version: 1.0 References: <20201116084413.3312631-1-tzungbi@google.com> X-Mailer: git-send-email 2.29.2.299.gdc1121823c-goog Subject: [PATCH v2 1/3] remoteproc/mediatek: fix boundary check From: Tzung-Bi Shih To: ohad@wizery.com, bjorn.andersson@linaro.org X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201116_034438_731865_809AC908 X-CRM114-Status: GOOD ( 13.57 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-remoteproc@vger.kernel.org, tzungbi@google.com, linux-mediatek@lists.infradead.org, pihsun@chromium.org, matthias.bgg@gmail.com, linux-arm-kernel@lists.infradead.org Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org It is valid if offset+length == sram_size. For example, sram_size=100, offset=99, length=1. Accessing offset 99 with length 1 is valid. Signed-off-by: Tzung-Bi Shih --- drivers/remoteproc/mtk_scp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/remoteproc/mtk_scp.c b/drivers/remoteproc/mtk_scp.c index a1e23b5f19b9..0abbeb62cf43 100644 --- a/drivers/remoteproc/mtk_scp.c +++ b/drivers/remoteproc/mtk_scp.c @@ -408,11 +408,11 @@ static void *scp_da_to_va(struct rproc *rproc, u64 da, size_t len) if (da < scp->sram_size) { offset = da; - if (offset >= 0 && (offset + len) < scp->sram_size) + if (offset >= 0 && (offset + len) <= scp->sram_size) return (void __force *)scp->sram_base + offset; } else if (scp->dram_size) { offset = da - scp->dma_addr; - if (offset >= 0 && (offset + len) < scp->dram_size) + if (offset >= 0 && (offset + len) <= scp->dram_size) return scp->cpu_addr + offset; } -- 2.29.2.299.gdc1121823c-goog _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel