Skip to content

Commit 4223414

Browse files
KarolPWrherbertx
authored andcommitted
crypto: marvell/cesa - fix uninit value for struct mv_cesa_op_ctx
In cesa/cipher.c most declarations of struct mv_cesa_op_ctx are uninitialized. This causes one of the values in the struct to be left unitialized in later usages. This patch fixes it by adding initializations in the same way it is done in cesa/hash.c. Fixes errors discovered in coverity: 1600942, 1600939, 1600935, 1600934, 1600929, 1600927, 1600925, 1600921, 1600920, 1600919, 1600915, 1600914 Signed-off-by: Karol Przybylski <karprzy7@gmail.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
1 parent 572b7cf commit 4223414

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

drivers/crypto/marvell/cesa/cipher.c

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -489,7 +489,7 @@ static int mv_cesa_des_op(struct skcipher_request *req,
489489

490490
static int mv_cesa_ecb_des_encrypt(struct skcipher_request *req)
491491
{
492-
struct mv_cesa_op_ctx tmpl;
492+
struct mv_cesa_op_ctx tmpl = { };
493493

494494
mv_cesa_set_op_cfg(&tmpl,
495495
CESA_SA_DESC_CFG_CRYPTCM_ECB |
@@ -500,7 +500,7 @@ static int mv_cesa_ecb_des_encrypt(struct skcipher_request *req)
500500

501501
static int mv_cesa_ecb_des_decrypt(struct skcipher_request *req)
502502
{
503-
struct mv_cesa_op_ctx tmpl;
503+
struct mv_cesa_op_ctx tmpl = { };
504504

505505
mv_cesa_set_op_cfg(&tmpl,
506506
CESA_SA_DESC_CFG_CRYPTCM_ECB |
@@ -543,7 +543,7 @@ static int mv_cesa_cbc_des_op(struct skcipher_request *req,
543543

544544
static int mv_cesa_cbc_des_encrypt(struct skcipher_request *req)
545545
{
546-
struct mv_cesa_op_ctx tmpl;
546+
struct mv_cesa_op_ctx tmpl = { };
547547

548548
mv_cesa_set_op_cfg(&tmpl, CESA_SA_DESC_CFG_DIR_ENC);
549549

@@ -552,7 +552,7 @@ static int mv_cesa_cbc_des_encrypt(struct skcipher_request *req)
552552

553553
static int mv_cesa_cbc_des_decrypt(struct skcipher_request *req)
554554
{
555-
struct mv_cesa_op_ctx tmpl;
555+
struct mv_cesa_op_ctx tmpl = { };
556556

557557
mv_cesa_set_op_cfg(&tmpl, CESA_SA_DESC_CFG_DIR_DEC);
558558

@@ -596,7 +596,7 @@ static int mv_cesa_des3_op(struct skcipher_request *req,
596596

597597
static int mv_cesa_ecb_des3_ede_encrypt(struct skcipher_request *req)
598598
{
599-
struct mv_cesa_op_ctx tmpl;
599+
struct mv_cesa_op_ctx tmpl = { };
600600

601601
mv_cesa_set_op_cfg(&tmpl,
602602
CESA_SA_DESC_CFG_CRYPTCM_ECB |
@@ -608,7 +608,7 @@ static int mv_cesa_ecb_des3_ede_encrypt(struct skcipher_request *req)
608608

609609
static int mv_cesa_ecb_des3_ede_decrypt(struct skcipher_request *req)
610610
{
611-
struct mv_cesa_op_ctx tmpl;
611+
struct mv_cesa_op_ctx tmpl = { };
612612

613613
mv_cesa_set_op_cfg(&tmpl,
614614
CESA_SA_DESC_CFG_CRYPTCM_ECB |
@@ -649,7 +649,7 @@ static int mv_cesa_cbc_des3_op(struct skcipher_request *req,
649649

650650
static int mv_cesa_cbc_des3_ede_encrypt(struct skcipher_request *req)
651651
{
652-
struct mv_cesa_op_ctx tmpl;
652+
struct mv_cesa_op_ctx tmpl = { };
653653

654654
mv_cesa_set_op_cfg(&tmpl,
655655
CESA_SA_DESC_CFG_CRYPTCM_CBC |
@@ -661,7 +661,7 @@ static int mv_cesa_cbc_des3_ede_encrypt(struct skcipher_request *req)
661661

662662
static int mv_cesa_cbc_des3_ede_decrypt(struct skcipher_request *req)
663663
{
664-
struct mv_cesa_op_ctx tmpl;
664+
struct mv_cesa_op_ctx tmpl = { };
665665

666666
mv_cesa_set_op_cfg(&tmpl,
667667
CESA_SA_DESC_CFG_CRYPTCM_CBC |
@@ -725,7 +725,7 @@ static int mv_cesa_aes_op(struct skcipher_request *req,
725725

726726
static int mv_cesa_ecb_aes_encrypt(struct skcipher_request *req)
727727
{
728-
struct mv_cesa_op_ctx tmpl;
728+
struct mv_cesa_op_ctx tmpl = { };
729729

730730
mv_cesa_set_op_cfg(&tmpl,
731731
CESA_SA_DESC_CFG_CRYPTCM_ECB |
@@ -736,7 +736,7 @@ static int mv_cesa_ecb_aes_encrypt(struct skcipher_request *req)
736736

737737
static int mv_cesa_ecb_aes_decrypt(struct skcipher_request *req)
738738
{
739-
struct mv_cesa_op_ctx tmpl;
739+
struct mv_cesa_op_ctx tmpl = { };
740740

741741
mv_cesa_set_op_cfg(&tmpl,
742742
CESA_SA_DESC_CFG_CRYPTCM_ECB |
@@ -778,7 +778,7 @@ static int mv_cesa_cbc_aes_op(struct skcipher_request *req,
778778

779779
static int mv_cesa_cbc_aes_encrypt(struct skcipher_request *req)
780780
{
781-
struct mv_cesa_op_ctx tmpl;
781+
struct mv_cesa_op_ctx tmpl = { };
782782

783783
mv_cesa_set_op_cfg(&tmpl, CESA_SA_DESC_CFG_DIR_ENC);
784784

@@ -787,7 +787,7 @@ static int mv_cesa_cbc_aes_encrypt(struct skcipher_request *req)
787787

788788
static int mv_cesa_cbc_aes_decrypt(struct skcipher_request *req)
789789
{
790-
struct mv_cesa_op_ctx tmpl;
790+
struct mv_cesa_op_ctx tmpl = { };
791791

792792
mv_cesa_set_op_cfg(&tmpl, CESA_SA_DESC_CFG_DIR_DEC);
793793

0 commit comments

Comments
 (0)