Skip to content

Commit 606d6b7

Browse files
authored
Merge pull request #161 from jackctj117/coverity-fixes
Initialized declared reqs
2 parents 19e88be + beffdca commit 606d6b7

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

src/wh_client_cert.c

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ int wh_Client_CertAddTrustedRequest(whClientContext* c, whNvmId id,
119119
uint8_t* label, whNvmSize label_len,
120120
const uint8_t* cert, uint32_t cert_len)
121121
{
122-
whMessageCert_AddTrustedRequest req;
122+
whMessageCert_AddTrustedRequest req = {0};
123123
uint8_t buffer[WOLFHSM_CFG_COMM_DATA_LEN] = {0};
124124
uint16_t hdr_len = sizeof(req);
125125
uint8_t* payload = buffer + hdr_len;
@@ -209,7 +209,7 @@ int wh_Client_CertAddTrusted(whClientContext* c, whNvmId id, whNvmAccess access,
209209
/* Delete a trusted certificate */
210210
int wh_Client_CertEraseTrustedRequest(whClientContext* c, whNvmId id)
211211
{
212-
whMessageCert_EraseTrustedRequest req;
212+
whMessageCert_EraseTrustedRequest req = {0};
213213

214214
if (c == NULL) {
215215
return WH_ERROR_BADARGS;
@@ -278,7 +278,7 @@ int wh_Client_CertReadTrustedRequest(whClientContext* c, whNvmId id,
278278
uint32_t cert_len)
279279
{
280280
(void)cert_len;
281-
whMessageCert_ReadTrustedRequest req;
281+
whMessageCert_ReadTrustedRequest req = {0};
282282

283283
if (c == NULL) {
284284
return WH_ERROR_BADARGS;
@@ -364,7 +364,7 @@ static int _certVerifyRequest(whClientContext* c, const uint8_t* cert,
364364
uint32_t cert_len, whNvmId trustedRootNvmId,
365365
uint16_t flags, whKeyId keyId)
366366
{
367-
whMessageCert_VerifyRequest req;
367+
whMessageCert_VerifyRequest req = {0};
368368
uint8_t buffer[WOLFHSM_CFG_COMM_DATA_LEN] = {0};
369369
uint16_t hdr_len = sizeof(req);
370370
uint8_t* payload = buffer + hdr_len;
@@ -507,7 +507,7 @@ int wh_Client_CertAddTrustedDmaRequest(whClientContext* c, whNvmId id,
507507
uint8_t* label, whNvmSize label_len,
508508
const void* cert, uint32_t cert_len)
509509
{
510-
whMessageCert_AddTrustedDmaRequest req;
510+
whMessageCert_AddTrustedDmaRequest req = {0};
511511

512512
if (c == NULL || cert_len > WOLFHSM_CFG_MAX_CERT_SIZE) {
513513
return WH_ERROR_BADARGS;
@@ -589,7 +589,7 @@ int wh_Client_CertAddTrustedDma(whClientContext* c, whNvmId id,
589589
int wh_Client_CertReadTrustedDmaRequest(whClientContext* c, whNvmId id,
590590
void* cert, uint32_t cert_len)
591591
{
592-
whMessageCert_ReadTrustedDmaRequest req;
592+
whMessageCert_ReadTrustedDmaRequest req = {0};
593593

594594
if (c == NULL) {
595595
return WH_ERROR_BADARGS;
@@ -660,7 +660,7 @@ static int _certVerifyDmaRequest(whClientContext* c, const void* cert,
660660
uint32_t cert_len, whNvmId trustedRootNvmId,
661661
uint16_t flags, whKeyId keyId)
662662
{
663-
whMessageCert_VerifyDmaRequest req;
663+
whMessageCert_VerifyDmaRequest req = {0};
664664

665665
if (c == NULL) {
666666
return WH_ERROR_BADARGS;
@@ -797,7 +797,7 @@ int wh_Client_CertVerifyAcertRequest(whClientContext* c, const void* cert,
797797
uint32_t cert_len,
798798
whNvmId trustedRootNvmId)
799799
{
800-
whMessageCert_VerifyAcertRequest req;
800+
whMessageCert_VerifyAcertRequest req = {0};
801801
uint8_t buffer[WOLFHSM_CFG_COMM_DATA_LEN];
802802
size_t hdr_len = sizeof(req);
803803
uint8_t* payload = buffer + hdr_len;
@@ -875,7 +875,7 @@ int wh_Client_CertVerifyAcertDmaRequest(whClientContext* c, const void* cert,
875875
uint32_t cert_len,
876876
whNvmId trustedRootNvmId)
877877
{
878-
whMessageCert_VerifyDmaRequest req;
878+
whMessageCert_VerifyDmaRequest req = {0};
879879

880880
if (c == NULL) {
881881
return WH_ERROR_BADARGS;

0 commit comments

Comments
 (0)