diff mbox series

[next] crypto: asymmetric_keys: remove redundant pointer secs

Message ID 20240118120745.2519762-1-colin.i.king@gmail.com (mailing list archive)
State Accepted
Delegated to: Herbert Xu
Headers show
Series [next] crypto: asymmetric_keys: remove redundant pointer secs | expand

Commit Message

Colin Ian King Jan. 18, 2024, 12:07 p.m. UTC
The pointer secs is being assigned a value however secs is never
read afterwards. The pointer secs is redundant and can be removed.

Cleans up clang scan build warning:
warning: Although the value stored to 'secs' is used in the enclosing
expression, the value is never actually read from 'secs'
[deadcode.DeadStores]

Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
---
 crypto/asymmetric_keys/verify_pefile.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Jarkko Sakkinen Jan. 19, 2024, 9:12 p.m. UTC | #1
On Thu Jan 18, 2024 at 12:07 PM UTC, Colin Ian King wrote:
> The pointer secs is being assigned a value however secs is never
> read afterwards. The pointer secs is redundant and can be removed.
>
> Cleans up clang scan build warning:
> warning: Although the value stored to 'secs' is used in the enclosing
> expression, the value is never actually read from 'secs'
> [deadcode.DeadStores]
>
> Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
> ---
>  crypto/asymmetric_keys/verify_pefile.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/crypto/asymmetric_keys/verify_pefile.c b/crypto/asymmetric_keys/verify_pefile.c
> index f440767bd727..2863984b6700 100644
> --- a/crypto/asymmetric_keys/verify_pefile.c
> +++ b/crypto/asymmetric_keys/verify_pefile.c
> @@ -28,7 +28,7 @@ static int pefile_parse_binary(const void *pebuf, unsigned int pelen,
>  	const struct pe32plus_opt_hdr *pe64;
>  	const struct data_directory *ddir;
>  	const struct data_dirent *dde;
> -	const struct section_header *secs, *sec;
> +	const struct section_header *sec;
>  	size_t cursor, datalen = pelen;
>  
>  	kenter("");
> @@ -110,7 +110,7 @@ static int pefile_parse_binary(const void *pebuf, unsigned int pelen,
>  	ctx->n_sections = pe->sections;
>  	if (ctx->n_sections > (ctx->header_size - cursor) / sizeof(*sec))
>  		return -ELIBBAD;
> -	ctx->secs = secs = pebuf + cursor;
> +	ctx->secs = pebuf + cursor;
>  
>  	return 0;
>  }

Reviewed-by: Jarkko Sakkinen <jarkko@kernel.org>

BR, Jarkko
Herbert Xu Jan. 26, 2024, 9:03 a.m. UTC | #2
On Thu, Jan 18, 2024 at 12:07:45PM +0000, Colin Ian King wrote:
> The pointer secs is being assigned a value however secs is never
> read afterwards. The pointer secs is redundant and can be removed.
> 
> Cleans up clang scan build warning:
> warning: Although the value stored to 'secs' is used in the enclosing
> expression, the value is never actually read from 'secs'
> [deadcode.DeadStores]
> 
> Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
> ---
>  crypto/asymmetric_keys/verify_pefile.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

Patch applied.  Thanks.
diff mbox series

Patch

diff --git a/crypto/asymmetric_keys/verify_pefile.c b/crypto/asymmetric_keys/verify_pefile.c
index f440767bd727..2863984b6700 100644
--- a/crypto/asymmetric_keys/verify_pefile.c
+++ b/crypto/asymmetric_keys/verify_pefile.c
@@ -28,7 +28,7 @@  static int pefile_parse_binary(const void *pebuf, unsigned int pelen,
 	const struct pe32plus_opt_hdr *pe64;
 	const struct data_directory *ddir;
 	const struct data_dirent *dde;
-	const struct section_header *secs, *sec;
+	const struct section_header *sec;
 	size_t cursor, datalen = pelen;
 
 	kenter("");
@@ -110,7 +110,7 @@  static int pefile_parse_binary(const void *pebuf, unsigned int pelen,
 	ctx->n_sections = pe->sections;
 	if (ctx->n_sections > (ctx->header_size - cursor) / sizeof(*sec))
 		return -ELIBBAD;
-	ctx->secs = secs = pebuf + cursor;
+	ctx->secs = pebuf + cursor;
 
 	return 0;
 }