All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: clabbe.montjoie@gmail.com
Cc: linux-crypto@vger.kernel.org
Subject: re: crypto: sahara - check return value of sg_nents_for_len
Date: Thu, 19 Nov 2015 02:06:42 +0300	[thread overview]
Message-ID: <20151118230642.GA29804@mwanda> (raw)

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

             reply	other threads:[~2015-11-18 23:06 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-18 23:06 Dan Carpenter [this message]
2015-11-19  9:30 ` crypto: sahara - check return value of sg_nents_for_len LABBE Corentin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20151118230642.GA29804@mwanda \
    --to=dan.carpenter@oracle.com \
    --cc=clabbe.montjoie@gmail.com \
    --cc=linux-crypto@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.