public inbox for linux-crypto@vger.kernel.org
 help / color / mirror / Atom feed
From: Tom Lendacky <thomas.lendacky@amd.com>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: <linux-crypto@vger.kernel.org>
Subject: Re: crypto: ccp - CCP SHA crypto API support
Date: Wed, 11 Dec 2013 08:45:47 -0600	[thread overview]
Message-ID: <7125615.uB987Qo2Ax@tlendack-t1> (raw)
In-Reply-To: <20131211105150.GA422@elgon.mountain>


On Wednesday, December 11, 2013 01:51:50 PM Dan Carpenter wrote:
> Hello Tom Lendacky,
> 
> The patch 0ab0a1d505ab: "crypto: ccp - CCP SHA crypto API support"
> from Nov 12, 2013, leads to the following static checker warning:
> 	drivers/crypto/ccp/ccp-crypto-sha.c:182 ccp_do_sha_update()
> 	warn: should 'rctx->hash_cnt << 3' be a 64 bit type?
> 
> drivers/crypto/ccp/ccp-crypto-sha.c
>    180                  sg_mark_end(sg);
>    181
>    182          rctx->msg_bits += (rctx->hash_cnt << 3);        /* Total in
> bits */ ^^^^^^^^^^^^^^^^^^^
> This operation wraps if the msg is over 500MB.  I'm not sure if that's
> possible, but ->msg_bits is declared as a u64 here and in
> rctx->cmd.u.sha.msg_bits as well.

I should probably cast hash_cnt to a u64 before doing the shift to be
sure I don't lose any bits.  So that I can validate my fix, which static
checker did you run?

Thanks,
Tom
 
> 
>    183
>    184          memset(&rctx->cmd, 0, sizeof(rctx->cmd));
> 
> 
> regards,
> dan carpenter

  reply	other threads:[~2013-12-11 14:45 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-11 10:51 crypto: ccp - CCP SHA crypto API support Dan Carpenter
2013-12-11 14:45 ` Tom Lendacky [this message]
2013-12-11 15:20   ` Dan Carpenter

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=7125615.uB987Qo2Ax@tlendack-t1 \
    --to=thomas.lendacky@amd.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox