Skip to contentSkip to conversation

crypto: chcr - Add AEAD algos.

bug report Dan Carpenter 1 participant 2 messages Dec 1, 2016 – Jan 24, 2017 Crypto API

lore
Share & tools
lore
#0 lore raw

Hello Harsh Jain,

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

The patch 2debd3325e55: "crypto: chcr - Add AEAD algos." from Nov 29, 2016, leads to the following Smatch complaint:

	drivers/crypto/chelsio/chcr_algo.c:2460 chcr_aead_op()
	warn: variable dereferenced before check 'ctx' (see line 2457)

	drivers/crypto/chelsio/chcr_algo.c:2460 chcr_aead_op()
	warn: variable dereferenced before check 'ctx->dev' (see line 2457)

drivers/crypto/chelsio/chcr_algo.c
2456 struct chcr_context *ctx = crypto_aead_ctx(tfm);

  2457		struct uld_ctx *u_ctx = ULD_CTX(ctx);
                                        ^^^^^^^^^^^^

Derefences both.

2458 struct sk_buff *skb;
2459

  2460		if (ctx && !ctx->dev) {
                    ^^^^^^^^^^^^^^^^

Check is too late.

  2461			pr_err("chcr : %s : No crypto device.\n", __func__);
  2462			return -ENXIO;

regards,
dan carpenter

#1 lore raw

Ping?

regards,
dan carpenter

Quoted 30 lines · Dan Carpenter

Hello Harsh Jain,

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

The patch 2debd3325e55: "crypto: chcr - Add AEAD algos." from Nov 29, 2016, leads to the following Smatch complaint:

	drivers/crypto/chelsio/chcr_algo.c:2460 chcr_aead_op()
	warn: variable dereferenced before check 'ctx' (see line 2457)

	drivers/crypto/chelsio/chcr_algo.c:2460 chcr_aead_op()
	warn: variable dereferenced before check 'ctx->dev' (see line 2457)

drivers/crypto/chelsio/chcr_algo.c
2456 struct chcr_context *ctx = crypto_aead_ctx(tfm);

  2457		struct uld_ctx *u_ctx = ULD_CTX(ctx);
                                        ^^^^^^^^^^^^

Derefences both.

2458 struct sk_buff *skb;
2459

  2460		if (ctx && !ctx->dev) {
                    ^^^^^^^^^^^^^^^^

Check is too late.

  2461			pr_err("chcr : %s : No crypto device.\n", __func__);
  2462			return -ENXIO;

regards,
dan carpenter