[bug report] crypto: sa2ul - Add crypto driver

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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



[Index of Archives]     [Kernel]     [Gnu Classpath]     [Gnu Crypto]     [DM Crypt]     [Netfilter]     [Bugtraq]

  Powered by Linux