lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <3292ae5e-07e2-49df-81f7-74e1b5e8dfb3@milecki.pl>
Date: Tue, 30 Jan 2024 22:10:50 +0100
From: Rafał Miłecki <rafal@...ecki.pl>
To: Nick Spooner <nicholas.spooner@...gate.com>,
 "srinivas.kandagatla@...aro.org" <srinivas.kandagatla@...aro.org>,
 Dan Carpenter <dan.carpenter@...aro.org>
Cc: Evan Burgess <evan.burgess@...gate.com>,
 "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
 "kernel-janitors@...r.kernel.org" <kernel-janitors@...r.kernel.org>
Subject: Re: [PATCH v2] nvmem: u-boot-env: improve error checking

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@...gate.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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ