Skip to contentSkip to conversation

crypto: echainiv - Add encrypted chain IV generator

DISCUSSION Dan Carpenter 1 participant 1 message May 26, 2015 Crypto API

lore
Share & tools
lore
#0 lore raw

Hello Herbert Xu,

The patch a10f554fa7e0: "crypto: echainiv - Add encrypted chain IV generator" from May 21, 2015, leads to the following static checker warning:

crypto/echainiv.c:492 echainiv_alloc()
warn: 'inst' isn't an ERR_PTR

crypto/echainiv.c
435 static struct crypto_instance *echainiv_aead_alloc(struct rtattr **tb) 436 {

   437          struct aead_instance *inst;
   438          struct crypto_aead_spawn *spawn;
   439          struct aead_alg *alg;
   440  
   441          inst = aead_geniv_alloc(&echainiv_tmpl, tb, 0, 0);
   442  
   443          if (IS_ERR(inst))
   444                  goto out;
   445  
   446          if (inst->alg.ivsize < sizeof(u64) ||
   447              inst->alg.ivsize & (sizeof(u32) - 1) ||
   448              inst->alg.ivsize > MAX_IV_SIZE) {
   449                  aead_geniv_free(inst);
   450                  inst = ERR_PTR(-EINVAL);
   451                  goto out;
                        ^^^^^^^^

Goto out here means return the container_of() an error pointer. This is a class of bugs called a "one err bug" because all the error paths go to the same error label.

452 }
453

regards,
dan carpenter