From: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
To: Shunqian Zheng <zhengsq@rock-chips.com>,
maxime.ripard@free-electrons.com, heiko@sntech.de,
linux-kernel@vger.kernel.org, caesar.wang@rock-chips.com
Cc: dianders@chromium.org, linux-rockchip@lists.infradead.org,
xjq@rock-chips.com
Subject: Re: [PATCH 1/3] nvmem: fix the out-of-range leak in read/write()
Date: Mon, 10 Aug 2015 09:49:19 +0100 [thread overview]
Message-ID: <55C8658F.4000201@linaro.org> (raw)
In-Reply-To: <1439176963-8969-2-git-send-email-zhengsq@rock-chips.com>
On 10/08/15 04:22, Shunqian Zheng wrote:
> From: ZhengShunQian <zhengsq@rock-chips.com>
>
> The position to read/write must be less than max
> register size.
>
> Signed-off-by: ZhengShunQian <zhengsq@rock-chips.com>
> ---
> drivers/nvmem/core.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/nvmem/core.c b/drivers/nvmem/core.c
> index d3c6676..f4af8e5 100644
> --- a/drivers/nvmem/core.c
> +++ b/drivers/nvmem/core.c
> @@ -67,7 +67,7 @@ static ssize_t bin_attr_nvmem_read(struct file *filp, struct kobject *kobj,
> int rc;
>
> /* Stop the user from reading */
> - if (pos > nvmem->size)
> + if (pos >= nvmem->size)
> return 0;
>
> if (pos + count > nvmem->size)
> @@ -92,7 +92,7 @@ static ssize_t bin_attr_nvmem_write(struct file *filp, struct kobject *kobj,
> int rc;
>
> /* Stop the user from writing */
> - if (pos > nvmem->size)
> + if (pos >= nvmem->size)
> return 0;
>
> if (pos + count > nvmem->size)
>
This looks good,
Acked-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
next prev parent reply other threads:[~2015-08-10 8:49 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-08-10 3:22 [PATCH 0/3] Add eFuse driver of Rockchip SoC Shunqian Zheng
2015-08-10 3:22 ` [PATCH 1/3] nvmem: fix the out-of-range leak in read/write() Shunqian Zheng
2015-08-10 8:49 ` Srinivas Kandagatla [this message]
2015-08-10 3:22 ` [PATCH 2/3] nvmem: rockchip-efuse: implement eFuse driver Shunqian Zheng
2015-08-10 8:58 ` Srinivas Kandagatla
2015-08-10 3:22 ` [PATCH 3/3] clk: rockchip: do not gate the efuse256 clock Shunqian Zheng
2015-08-10 8:08 ` Heiko Stübner
2015-08-10 8:37 ` Shunqian Zheng
2015-08-10 8:48 ` Srinivas Kandagatla
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=55C8658F.4000201@linaro.org \
--to=srinivas.kandagatla@linaro.org \
--cc=caesar.wang@rock-chips.com \
--cc=dianders@chromium.org \
--cc=heiko@sntech.de \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rockchip@lists.infradead.org \
--cc=maxime.ripard@free-electrons.com \
--cc=xjq@rock-chips.com \
--cc=zhengsq@rock-chips.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox