ell.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
* Re: [PATCH 1/2] cert-crypto: pragma false positive (-Wmaybe-uninitialized)
@ 2022-06-10 17:16 Denis Kenzior
  0 siblings, 0 replies; 2+ messages in thread
From: Denis Kenzior @ 2022-06-10 17:16 UTC (permalink / raw)
  To: ell

[-- Attachment #1: Type: text/plain, Size: 635 bytes --]

Hi James,

On 6/10/22 12:11, James Prestwood wrote:
> On musl-gcc 'bmpstring' was detected as maybe uninitialized. This
> is actually a false positive since the usage is guarded by
> if (p_len) but the compiler isn't aware. Pragma to ignore this
> warning.
> 
> ell/cert-crypto.c: In function 'cert_pkcs12_pbkdf':
> ell/cert-crypto.c:246:17: error: 'bmpstring' may be used uninitialized in this function [-Werror=maybe-uninitialized]
>    246 |                 explicit_bzero(bmpstring, passwd_len);
> ---
>   ell/cert-crypto.c | 3 +++
>   1 file changed, 3 insertions(+)
> 

Both applied, thanks.

Regards,
-Denis

^ permalink raw reply	[flat|nested] 2+ messages in thread

* [PATCH 1/2] cert-crypto: pragma false positive (-Wmaybe-uninitialized)
@ 2022-06-10 17:11 James Prestwood
  0 siblings, 0 replies; 2+ messages in thread
From: James Prestwood @ 2022-06-10 17:11 UTC (permalink / raw)
  To: ell

[-- Attachment #1: Type: text/plain, Size: 1174 bytes --]

On musl-gcc 'bmpstring' was detected as maybe uninitialized. This
is actually a false positive since the usage is guarded by
if (p_len) but the compiler isn't aware. Pragma to ignore this
warning.

ell/cert-crypto.c: In function 'cert_pkcs12_pbkdf':
ell/cert-crypto.c:246:17: error: 'bmpstring' may be used uninitialized in this function [-Werror=maybe-uninitialized]
  246 |                 explicit_bzero(bmpstring, passwd_len);
---
 ell/cert-crypto.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/ell/cert-crypto.c b/ell/cert-crypto.c
index cc312e2..e6e8876 100644
--- a/ell/cert-crypto.c
+++ b/ell/cert-crypto.c
@@ -236,6 +236,8 @@ uint8_t *cert_pkcs12_pbkdf(const char *password,
 		ptr += s_len + salt_len - j;
 	}
 
+_Pragma("GCC diagnostic push")
+_Pragma("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
 	if (p_len) {
 		for (j = passwd_len; j < p_len;
 					j += passwd_len, ptr += passwd_len)
@@ -246,6 +248,7 @@ uint8_t *cert_pkcs12_pbkdf(const char *password,
 		explicit_bzero(bmpstring, passwd_len);
 		l_free(bmpstring);
 	}
+_Pragma("GCC diagnostic pop")
 
 	key = l_malloc(key_len + hash->len);
 
-- 
2.34.1

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-06-10 17:16 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-10 17:16 [PATCH 1/2] cert-crypto: pragma false positive (-Wmaybe-uninitialized) Denis Kenzior
  -- strict thread matches above, loose matches on Subject: below --
2022-06-10 17:11 James Prestwood

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).