Skip to contentSkip to conversation

crypto: asymmetric_keys: remove redundant pointer secs

PATCH In review Colin Ian King 3 participants 3 messages Jan 18, 2024 – Jan 26, 2024

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 crypto: asymmetric_keys: remove redundant pointer secs

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]

---
 crypto/asymmetric_keys/verify_pefile.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
crypto/asymmetric_keys/verify_pefile.c +2 -2
index f440767bd727..2863984b6700 100644
@@ -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;
 }
Signature · 1 line
2.39.2
maintainer Reviewed-by on v1 1/1
#1 lore raw
Quoted 27 lines · Colin Ian King

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]

---
 crypto/asymmetric_keys/verify_pefile.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
crypto/asymmetric_keys/verify_pefile.c +1 -1
index f440767bd727..2863984b6700 100644
@@ -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("");

crypto/asymmetric_keys/verify_pefile.c static int pefile_parse_binary(const void *pebuf, unsigned int pelen, · line 116

Quoted 8 lines
crypto/asymmetric_keys/verify_pefile.c +1 -1
@@ -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;
 }

BR, Jarkko

maintainer
#2 lore raw
In reply to Colin Ian King
Quoted 8 lines · Colin Ian King

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]

Quoted 4 lines
---
 crypto/asymmetric_keys/verify_pefile.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Patch applied. Thanks.

Signature · 3 lines
Email: Herbert Xu <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt