linux-crypto.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* re: crypto: sahara - check return value of sg_nents_for_len
@ 2015-11-18 23:06 Dan Carpenter
  2015-11-19  9:30 ` LABBE Corentin
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2015-11-18 23:06 UTC (permalink / raw)
  To: clabbe.montjoie; +Cc: linux-crypto

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-11-19  9:30 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-11-18 23:06 crypto: sahara - check return value of sg_nents_for_len Dan Carpenter
2015-11-19  9:30 ` LABBE Corentin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).