From: Tzung-Bi Shih <tzungbi@google.com>
To: ohad@wizery.com, bjorn.andersson@linaro.org
Cc: linux-remoteproc@vger.kernel.org, matthias.bgg@gmail.com,
linux-mediatek@lists.infradead.org,
linux-arm-kernel@lists.infradead.org, tzungbi@google.com,
pihsun@chromium.org
Subject: [PATCH 1/3] remoteproc/mediatek: fix boundary check
Date: Fri, 13 Nov 2020 15:02:05 +0800 [thread overview]
Message-ID: <20201113070207.836613-2-tzungbi@google.com> (raw)
In-Reply-To: <20201113070207.836613-1-tzungbi@google.com>
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 <tzungbi@google.com>
---
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 577cbd5d421e..7ba00305009a 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 (void __force *)scp->cpu_addr + offset;
}
--
2.29.2.299.gdc1121823c-goog
WARNING: multiple messages have this Message-ID (diff)
From: Tzung-Bi Shih <tzungbi@google.com>
To: ohad@wizery.com, bjorn.andersson@linaro.org
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
Subject: [PATCH 1/3] remoteproc/mediatek: fix boundary check
Date: Fri, 13 Nov 2020 15:02:05 +0800 [thread overview]
Message-ID: <20201113070207.836613-2-tzungbi@google.com> (raw)
In-Reply-To: <20201113070207.836613-1-tzungbi@google.com>
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 <tzungbi@google.com>
---
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 577cbd5d421e..7ba00305009a 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 (void __force *)scp->cpu_addr + offset;
}
--
2.29.2.299.gdc1121823c-goog
_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek
WARNING: multiple messages have this Message-ID (diff)
From: Tzung-Bi Shih <tzungbi@google.com>
To: ohad@wizery.com, bjorn.andersson@linaro.org
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
Subject: [PATCH 1/3] remoteproc/mediatek: fix boundary check
Date: Fri, 13 Nov 2020 15:02:05 +0800 [thread overview]
Message-ID: <20201113070207.836613-2-tzungbi@google.com> (raw)
In-Reply-To: <20201113070207.836613-1-tzungbi@google.com>
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 <tzungbi@google.com>
---
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 577cbd5d421e..7ba00305009a 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 (void __force *)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
next prev parent reply other threads:[~2020-11-13 7:02 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-13 7:02 [PATCH 0/3] remoteproc/mediatek: read IPI buffer offset from FW binary Tzung-Bi Shih
2020-11-13 7:02 ` Tzung-Bi Shih
2020-11-13 7:02 ` Tzung-Bi Shih
2020-11-13 7:02 ` Tzung-Bi Shih [this message]
2020-11-13 7:02 ` [PATCH 1/3] remoteproc/mediatek: fix boundary check Tzung-Bi Shih
2020-11-13 7:02 ` Tzung-Bi Shih
2020-11-13 7:02 ` [PATCH 2/3] remoteproc/mediatek: skip if filesz is 0 Tzung-Bi Shih
2020-11-13 7:02 ` Tzung-Bi Shih
2020-11-13 7:02 ` Tzung-Bi Shih
2020-11-13 7:02 ` [PATCH 3/3] remoteproc/mediatek: read IPI buffer offset from FW Tzung-Bi Shih
2020-11-13 7:02 ` Tzung-Bi Shih
2020-11-13 7:02 ` Tzung-Bi Shih
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20201113070207.836613-2-tzungbi@google.com \
--to=tzungbi@google.com \
--cc=bjorn.andersson@linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=linux-remoteproc@vger.kernel.org \
--cc=matthias.bgg@gmail.com \
--cc=ohad@wizery.com \
--cc=pihsun@chromium.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.