mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
To: Yanxin Huang <yanxin.huang@unisoc.com>,
	Orson Zhai <orsonzhai@gmail.com>,
	Baolin Wang <baolin.wang@linux.alibaba.com>,
	Chunyan Zhang <zhang.lyra@gmail.com>
Cc: linux-kernel@vger.kernel.org,
	huang yanxin <yanxin.huang07@gmail.com>,
	Wenming Wu <wenming.wu@unisoc.com>
Subject: Re: [PATCH 1/3] nvmem: sprd: Fix memory overflow issue during memcpy operation in efuse driver
Date: Fri, 8 Dec 2023 11:41:10 +0000	[thread overview]
Message-ID: <296be5ed-47a6-4701-a7f5-968e9e65b5f8@linaro.org> (raw)
In-Reply-To: <20231208061134.26354-1-yanxin.huang@unisoc.com>

thanks for the patch.

On 08/12/2023 06:11, Yanxin Huang wrote:
> The efuse driver didn't determine the size of bytes, resulting in memory
> overflow during memcpy operation.
> 
> Fixes: 096030e7f449 ("nvmem: sprd: Add Spreadtrum SoCs eFuse support")

Please add CC Stable for all the fixes.

> Signed-off-by: Yanxin Huang <yanxin.huang@unisoc.com>
> ---
>   drivers/nvmem/sprd-efuse.c | 1 +
>   1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/nvmem/sprd-efuse.c b/drivers/nvmem/sprd-efuse.c
> index bb3105f3291f..24b63620d217 100644
> --- a/drivers/nvmem/sprd-efuse.c
> +++ b/drivers/nvmem/sprd-efuse.c
> @@ -311,6 +311,7 @@ static int sprd_efuse_read(void *context, u32 offset, void *val, size_t bytes)
>   	ret = sprd_efuse_raw_read(efuse, index, &data, blk_double);
>   	if (!ret) {
>   		data >>= blk_offset;
> +		bytes = bytes > sizeof(data) ? sizeof(data) : bytes;

looks like sprd_efuse_read is only reading upto 4 bytes max, and 
silently ignoring reading requests data after 4 bytes.

Is this working because consumers so far only requested 4 bytes and less ?
does dumping nvmem sysfs actually show real content in your case?

--srini
>   		memcpy(val, &data, bytes);


>   	}
>   

      parent reply	other threads:[~2023-12-08 11:41 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-08  6:11 Yanxin Huang
2023-12-08  6:11 ` [PATCH 2/3] nvmem: sprd: Fix programming errors in efuse caused by incorrect parameters Yanxin Huang
2023-12-12  3:28   ` Baolin Wang
2023-12-08  6:11 ` [PATCH 3/3] nvmem: sprd: Remove the lock operation to support customers being able to program efuse multiple times Yanxin Huang
2023-12-12  3:37   ` Baolin Wang
2023-12-08 11:41 ` Srinivas Kandagatla [this message]

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=296be5ed-47a6-4701-a7f5-968e9e65b5f8@linaro.org \
    --to=srinivas.kandagatla@linaro.org \
    --cc=baolin.wang@linux.alibaba.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=orsonzhai@gmail.com \
    --cc=wenming.wu@unisoc.com \
    --cc=yanxin.huang07@gmail.com \
    --cc=yanxin.huang@unisoc.com \
    --cc=zhang.lyra@gmail.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

all inboxes | Powered by JetHome®