Closed Bug 1561598 Opened 5 years ago Closed 5 years ago

Remove -Wmaybe-uninitialized warning in pqg.c

Categories

(NSS :: Build, defect, P2)

defect

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: giulio.benetti, Assigned: giulio.benetti)

Details

Attachments

(1 file, 1 obsolete file)

User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.169 Safari/537.36

Steps to reproduce:

make nss_build_all BUILD_OPT=1 ALLOW_OPT_CODE_SIZE=1 OPT_CODE_SIZE=1 NSS_BUILD_SOFTOKEN_ONLY=1

Actual results:

pqg.c: In function ‘PQG_VerifyParams’:
pqg.c:1806:27: error: ‘type’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
if ((vfy->h.len == 1) && (type != FIPS186_1_TYPE)) {
^
In file included from pqg.c:21:0:
secmpi.h:8:8: error: ‘hashtype’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
if (SECSuccess != (rv = func))
^
pqg.c:1624:19: note: ‘hashtype’ was declared here
HASH_HashType hashtype;
^
cc1: all warnings being treated as errors

Expected results:

No warnings at all.

This patch fixes the warning.

Assignee: nobody → giulio.benetti
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true
Priority: -- → P2
Attachment #9074171 - Flags: review?(marcus.apb)
Comment on attachment 9074171 [details] [diff] [review]
0001-Bug-1561598-Remove-Wmaybe-uninitialized-warning-in-p.patch

Hi Giulio,

Thanks to inform and suggest a fix.
There are other places where this variable can be initialized too.
https://searchfox.org/mozilla-central/source/security/nss/lib/freebl/pqg.c#893
https://searchfox.org/mozilla-central/source/security/nss/lib/freebl/pqg.c#1242
https://searchfox.org/mozilla-central/source/security/nss/lib/freebl/pqg.c#1633

Could you update the patch, please?
It would be better if you send the patch using moz-php.
https://moz-conduit.readthedocs.io/en/latest/phabricator-user.html

Thanks,
Flags: needinfo?(giulio.benetti)
Comment on attachment 9074171 [details] [diff] [review]
0001-Bug-1561598-Remove-Wmaybe-uninitialized-warning-in-p.patch

Review of attachment 9074171 [details] [diff] [review]:
-----------------------------------------------------------------

There are other places with the same variable that should be fixed together.
Attachment #9074171 - Flags: review?(marcus.apb) → review-
Flags: needinfo?(giulio.benetti)

Hi Marcus,

above is the patch requested with no newline. I attach a new one. Sorry.

(In reply to Giulio Benetti from comment #5)

Hi Marcus,

above is the patch requested with no newline. I attach a new one. Sorry.

Nope, it's ok as it is.

Kindly ping.

Comment on attachment 9078361 [details] [diff] [review]
v2-0001-Bug-1561598-Remove-Wmaybe-uninitialized-warning-in-p.patch

Thanks Giulio.
Attachment #9078361 - Flags: review+
Keywords: checkin-needed
Attachment #9074171 - Attachment is obsolete: true
Status: ASSIGNED → RESOLVED
Closed: 5 years ago
Keywords: checkin-needed
Resolution: --- → FIXED
Target Milestone: --- → 3.46

Thanks again Giulio for these patches!

You're welcome, it's been a pleasure contributing with these patches :)

You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: