NetBSD-Bugs archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: lib/57895: crypt-argon2.c: gcc says using uninitialized delta.tv_sec
The following reply was made to PR lib/57895; it has been noted by GNATS.
From: mlelstv%serpens.de@localhost (Michael van Elst)
To: gnats-bugs%netbsd.org@localhost
Cc:
Subject: Re: lib/57895: crypt-argon2.c: gcc says using uninitialized delta.tv_sec
Date: Wed, 31 Jan 2024 16:51:12 -0000 (UTC)
hashikaw%mail.ru@localhost writes:
>>Description:
>in compile current, gcc -Os says
>/usr/src/lib/libcrypt/crypt-argon2.c: In function '__libcrypt_internal_estimate_argon2_params':
>/usr/src/lib/libcrypt/crypt-argon2.c:210:3: error: 'delta.tv_sec' may be used uninitialized in this function [-Werror=maybe-uninitialized]
> 210 | for (; delta.tv_sec < 1 && time < ARGON2_MAX_TIME; ++time) {
> | ^~~
>cc1: all warnings being treated as errors
Interesting that -Os detects this, but other -O levels do not.
Maybe:
Index: crypt-argon2.c
===================================================================
RCS file: /cvsroot/src/lib/libcrypt/crypt-argon2.c,v
retrieving revision 1.19
diff -p -u -r1.19 crypt-argon2.c
--- crypt-argon2.c 29 May 2022 12:15:00 -0000 1.19
+++ crypt-argon2.c 31 Jan 2024 16:48:36 -0000
@@ -207,7 +207,7 @@ estimate_argon2_params(argon2_type atype
if (clock_gettime(CLOCK_MONOTONIC, &tp1) == -1)
goto error;
- for (; delta.tv_sec < 1 && time < ARGON2_MAX_TIME; ++time) {
+ for (; time < ARGON2_MAX_TIME; ++time) {
if (argon2_hash(time, memory, threads,
tmp_pwd, sizeof(tmp_pwd),
tmp_salt, sizeof(tmp_salt),
@@ -221,6 +221,8 @@ estimate_argon2_params(argon2_type atype
if (timespeccmp(&tp1, &tp2, >))
break; /* broken system... */
timespecsub(&tp2, &tp1, &delta);
+ if (delta.tv_sec >= 1)
+ break;
}
} else {
time = *etime;
Home |
Main Index |
Thread Index |
Old Index