Re: crypto: sahara - check return value of sg_nents_for_len

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Nov 19, 2015 at 02:06:42AM +0300, Dan Carpenter wrote:
> Hello LABBE Corentin,
> 
> The patch 6c2b74d4774f: "crypto: sahara - check return value of
> sg_nents_for_len" from Nov 4, 2015, leads to the following static
> checker warning:
> 
> 	drivers/crypto/sahara.c:480 sahara_hw_descriptor_create()
> 	warn: unsigned 'dev->nb_in_sg' is never less than zero.
> 
> drivers/crypto/sahara.c
>    479          dev->nb_in_sg = sg_nents_for_len(dev->in_sg, dev->total);
>    480          if (dev->nb_in_sg < 0) {
>                     ^^^^^^^^^^^^^^^^^
> Unsigned is never less than zero.
> 
>    481                  dev_err(dev->device, "Invalid numbers of src SG.\n");
>    482                  return dev->nb_in_sg;
>    483          }
> 
> There are several other similar bugs as well:
> 
> drivers/crypto/sahara.c:485 sahara_hw_descriptor_create() warn: unsigned 'dev->nb_out_sg' is never less than zero.
> drivers/crypto/sahara.c:804 sahara_sha_hw_links_create() warn: unsigned 'dev->nb_in_sg' is never less than zero.
> drivers/crypto/picoxcell_crypto.c:298 spacc_sg_to_ddt() warn: unsigned 'nents' is never less than zero.
> drivers/crypto/picoxcell_crypto.c:338 spacc_aead_make_ddts() warn: unsigned 'src_nents' is never less than zero.
> drivers/crypto/picoxcell_crypto.c:348 spacc_aead_make_ddts() warn: unsigned 'dst_nents' is never less than zero.
> 
> regards,
> dan carpenter

Thanks for the reporting

I will send a patch for solving this.

Regards

--
To unsubscribe from this list: send the line "unsubscribe linux-crypto" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Kernel]     [Gnu Classpath]     [Gnu Crypto]     [DM Crypt]     [Netfilter]     [Bugtraq]

  Powered by Linux