Linux cryptographic layer development
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: ddstreet@ieee.org
Cc: linux-crypto@vger.kernel.org
Subject: re: crypto: nx - add hardware 842 crypto comp alg
Date: Thu, 14 May 2015 13:09:44 +0300	[thread overview]
Message-ID: <20150514100944.GA19879@mwanda> (raw)

Hello Dan Streetman,

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

The patch ed70b479c2c0: "crypto: nx - add hardware 842 crypto comp
alg" from May 7, 2015, leads to the following Smatch complaint:

drivers/crypto/nx/nx-842-crypto.c:301 nx842_crypto_compress()
	 warn: variable dereferenced before check 'tfm' (see line 292)

drivers/crypto/nx/nx-842-crypto.c
   288  static int nx842_crypto_compress(struct crypto_tfm *tfm,
   289                                   const u8 *src, unsigned int slen,
   290                                   u8 *dst, unsigned int *dlen)
   291	{
   292		struct nx842_crypto_ctx *ctx = crypto_tfm_ctx(tfm);
                                                              ^^^
Dereference.

   293		struct nx842_crypto_header *hdr = &ctx->header;
   294		struct nx842_crypto_param p;
   295		struct nx842_constraints c;
   296		unsigned int groups, hdrsize, h;
   297		int ret, n;
   298		bool add_header;
   299		u16 ignore = 0;
   300	
   301		if (!tfm || !src || !slen || !dst || !dlen)
                     ^^^
Checked for NULL.

   302			return -EINVAL;
   303	


The decompress function has the same warning:

	drivers/crypto/nx/nx-842-crypto.c:486 nx842_crypto_decompress()
	warn: variable dereferenced before check 'tfm' (see line 478)

regards,
dan carpenter

             reply	other threads:[~2015-05-14 10:10 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-14 10:09 Dan Carpenter [this message]
2015-05-15  7:04 ` re: crypto: nx - add hardware 842 crypto comp alg Herbert Xu
2015-05-15 15:07   ` [PATCH] crypto: remove 842-nx null checks Dan Streetman
2015-05-18  4:25     ` Herbert Xu

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=20150514100944.GA19879@mwanda \
    --to=dan.carpenter@oracle.com \
    --cc=ddstreet@ieee.org \
    --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