All of lore.kernel.org
 help / color / mirror / Atom feed
From: LABBE Corentin <clabbe.montjoie@gmail.com>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: linux-crypto@vger.kernel.org
Subject: Re: crypto: sahara - check return value of sg_nents_for_len
Date: Thu, 19 Nov 2015 10:30:24 +0100	[thread overview]
Message-ID: <20151119093024.GB32146@Red> (raw)
In-Reply-To: <20151118230642.GA29804@mwanda>

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

      reply	other threads:[~2015-11-19  9:30 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 message]

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=20151119093024.GB32146@Red \
    --to=clabbe.montjoie@gmail.com \
    --cc=dan.carpenter@oracle.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.