From: "Rafał Miłecki" <rafal@milecki.pl>
To: Nick Spooner <nicholas.spooner@seagate.com>,
"srinivas.kandagatla@linaro.org" <srinivas.kandagatla@linaro.org>,
Dan Carpenter <dan.carpenter@linaro.org>
Cc: Evan Burgess <evan.burgess@seagate.com>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"kernel-janitors@vger.kernel.org"
<kernel-janitors@vger.kernel.org>
Subject: Re: [PATCH v2] nvmem: u-boot-env: improve error checking
Date: Tue, 30 Jan 2024 22:10:50 +0100 [thread overview]
Message-ID: <3292ae5e-07e2-49df-81f7-74e1b5e8dfb3@milecki.pl> (raw)
In-Reply-To: <CH0PR20MB38183679A4F4229A419A9EB29C7D2@CH0PR20MB3818.namprd20.prod.outlook.com>
On 30.01.2024 20:42, Nick Spooner wrote:
> Coverity scan reported CID 1575482: error handling issues; this patch
> addresses this by adding error handling to u_boot_env_add_cells.
I'd appreciate description why do we need this change other than
addressing some Coverity report.
Should a single nvmem_add_one_cell() failure result in not registering
NVMEM device at all? Why?
> Signed-off-by: Nick Spooner <nicholas.spooner@seagate.com>
> ---
> v2:
> Fix whitespace issues in previous version
>
> drivers/nvmem/u-boot-env.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/nvmem/u-boot-env.c b/drivers/nvmem/u-boot-env.c
> index befbab156cda..c15de5f7fd99 100644
> --- a/drivers/nvmem/u-boot-env.c
> +++ b/drivers/nvmem/u-boot-env.c
> @@ -95,6 +95,7 @@ static int u_boot_env_add_cells(struct u_boot_env *priv, uint8_t *buf,
> struct device *dev = priv->dev;
> char *data = buf + data_offset;
> char *var, *value, *eq;
> + int rval;
>
> for (var = data;
> var < data + data_len && *var;
> @@ -119,7 +120,9 @@ static int u_boot_env_add_cells(struct u_boot_env *priv, uint8_t *buf,
> info.read_post_process = u_boot_env_read_post_process_ethaddr;
> }
>
> - nvmem_add_one_cell(nvmem, &info);
> + rval = nvmem_add_one_cell(nvmem, &info);
> + if (rval)
> + return rval;
> }
>
> return 0;
> --
> 2.34.1
next prev parent reply other threads:[~2024-01-31 5:29 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-30 19:42 Nick Spooner
2024-01-30 21:10 ` Rafał Miłecki [this message]
2024-01-30 23:25 ` Nick Spooner
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=3292ae5e-07e2-49df-81f7-74e1b5e8dfb3@milecki.pl \
--to=rafal@milecki.pl \
--cc=dan.carpenter@linaro.org \
--cc=evan.burgess@seagate.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=nicholas.spooner@seagate.com \
--cc=srinivas.kandagatla@linaro.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 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®