linux-crypto.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: <dan.carpenter@oracle.com>
To: j-keerthy@ti.com
Cc: linux-crypto@vger.kernel.org
Subject: [bug report] crypto: sa2ul - Add crypto driver
Date: Mon, 27 Jul 2020 14:20:20 +0300	[thread overview]
Message-ID: <20200727112020.GE389488@mwanda> (raw)

Hello Keerthy,

The patch 7694b6ca649f: "crypto: sa2ul - Add crypto driver" from Jul
13, 2020, leads to the following static checker warning:

	drivers/crypto/sa2ul.c:1201 sa_run()
	error: 'mdptr' dereferencing possible ERR_PTR()

drivers/crypto/sa2ul.c
  1176          rxd->enc = req->enc;
  1177          rxd->ddev = ddev;
  1178          rxd->src = src;
  1179          rxd->dst = dst;
  1180          rxd->iv_idx = req->ctx->iv_idx;
  1181          rxd->enc_iv_size = sa_ctx->cmdl_upd_info.enc_iv.size;
  1182          rxd->tx_in->callback = req->callback;
  1183          rxd->tx_in->callback_param = rxd;
  1184  
  1185          tx_out = dmaengine_prep_slave_sg(pdata->dma_tx, src,
  1186                                           src_nents, DMA_MEM_TO_DEV,
  1187                                           DMA_PREP_INTERRUPT | DMA_CTRL_ACK);
  1188  
  1189          if (!tx_out) {
  1190                  dev_err(pdata->dev, "OUT prep_slave_sg() failed\n");
  1191                  ret = -EINVAL;
  1192                  goto err_cleanup;
  1193          }
  1194  
  1195          /*
  1196           * Prepare metadata for DMA engine. This essentially describes the
  1197           * crypto algorithm to be used, data sizes, different keys etc.
  1198           */
  1199          mdptr = (u32 *)dmaengine_desc_get_metadata_ptr(tx_out, &pl, &ml);
                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
What about if this has an error?

  1200  
  1201          sa_prepare_tx_desc(mdptr, (sa_ctx->cmdl_size + (SA_PSDATA_CTX_WORDS *
  1202                                     sizeof(u32))), cmdl, sizeof(sa_ctx->epib),
  1203                             sa_ctx->epib);
  1204  
  1205          ml = sa_ctx->cmdl_size + (SA_PSDATA_CTX_WORDS * sizeof(u32));
  1206          dmaengine_desc_set_metadata_len(tx_out, req->mdata_size);
  1207  
  1208          dmaengine_submit(tx_out);
  1209          dmaengine_submit(rxd->tx_in);
  1210  
  1211          dma_async_issue_pending(dma_rx);
  1212          dma_async_issue_pending(pdata->dma_tx);
  1213  
  1214          return -EINPROGRESS;

regards,
dan carpenter

                 reply	other threads:[~2020-07-27 11:20 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=20200727112020.GE389488@mwanda \
    --to=dan.carpenter@oracle.com \
    --cc=j-keerthy@ti.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;
as well as URLs for NNTP newsgroup(s).