Linux cryptographic layer development
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: atul.gupta@chelsio.com
Cc: linux-crypto@vger.kernel.org
Subject: [bug report] chcr: Add support for Inline IPSec
Date: Mon, 4 Dec 2017 14:44:24 +0300	[thread overview]
Message-ID: <20171204114424.uibic3nesyzdp3zc@mwanda> (raw)

Hello Atul Gupta,

The patch 6dad4e8ab3ec: "chcr: Add support for Inline IPSec" from Nov
16, 2017, leads to the following static checker warning:

	drivers/crypto/chelsio/chcr_ipsec.c:431 copy_key_cpltx_pktxt()
	warn: potential pointer math issue ('q->q.desc' is a 512 bit pointer)

drivers/crypto/chelsio/chcr_ipsec.c
   419  
   420          if (likely(len <= left)) {
   421                  memcpy(key_ctx->key, sa_entry->key, key_len);
   422                  pos += key_len;
   423          } else {
   424                  if (key_len <= left) {
   425                          memcpy(pos, sa_entry->key, key_len);
   426                          pos += key_len;
   427                  } else {
   428                          memcpy(pos, sa_entry->key, left);
   429                          memcpy(q->q.desc, sa_entry->key + left,
   430                                 key_len - left);
   431                          pos = q->q.desc + (key_len - left);
                                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
This does look like a pointer math issue.  It should probably be:

				pos = (u8 *)q->q.desc + (key_len - left);

But I can't test this.

   432                  }
   433          }
   434          /* Copy CPL TX PKT XT */
   435          pos = copy_cpltx_pktxt(skb, dev, pos);

regards,
dan carpenter

                 reply	other threads:[~2017-12-04 11:44 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=20171204114424.uibic3nesyzdp3zc@mwanda \
    --to=dan.carpenter@oracle.com \
    --cc=atul.gupta@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