Linux cryptographic layer development
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: harsh@chelsio.com
Cc: linux-crypto@vger.kernel.org
Subject: [bug report] crypto: chelsio - Move DMA un/mapping to chcr from lld cxgb4 driver
Date: Wed, 8 Nov 2017 11:46:58 +0300	[thread overview]
Message-ID: <20171108084658.m2tkthbg4p2k7zcv@mwanda> (raw)

Hello Harsh Jain,

This is a semi-automatic email about new static checker warnings.

The patch 2f47d5804311: "crypto: chelsio - Move DMA un/mapping to
chcr from lld cxgb4 driver" from Oct 8, 2017, leads to the following
Smatch complaint:

    drivers/crypto/chelsio/chcr_algo.c:562 ulptx_walk_add_sg()
    error: we previously assumed 'sg' could be null (see line 551)

drivers/crypto/chelsio/chcr_algo.c
   550	
   551		while (sg && skip) {
                       ^^
The patch adds a new check for NULL

   552			if (sg_dma_len(sg) <= skip) {
   553				skip -= sg_dma_len(sg);
   554				skip_len = 0;
   555				sg = sg_next(sg);
   556			} else {
   557				skip_len = skip;
   558				skip = 0;
   559			}
   560		}
   561		if (walk->nents == 0) {
   562			small = min_t(unsigned int, sg_dma_len(sg) - skip_len, len);
                                                               ^^
This dereference (inside the macro) isn't checked.

   563			sgmin = min_t(unsigned int, small, CHCR_SRC_SG_SIZE);
   564			walk->sgl->len0 = cpu_to_be32(sgmin);

regards,
dan carpenter

                 reply	other threads:[~2017-11-08  8:47 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20171108084658.m2tkthbg4p2k7zcv@mwanda \
    --to=dan.carpenter@oracle.com \
    --cc=harsh@chelsio.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox