All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: schalla@marvell.com
Cc: SrujanaChalla <schalla@marvell.com>, linux-crypto@vger.kernel.org
Subject: [bug report] crypto: marvell - add support for OCTEON TX CPT engine
Date: Mon, 6 Apr 2020 17:43:02 +0300	[thread overview]
Message-ID: <20200406144302.GC68494@mwanda> (raw)

Hello SrujanaChalla,

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

The patch d9110b0b01ff: "crypto: marvell - add support for OCTEON TX 
CPT engine" from Mar 13, 2020, leads to the following Smatch 
complaint:

    drivers/crypto/marvell/octeontx/otx_cptpf_ucode.c:1300 create_engine_group()
    error: we previously assumed 'mirrored_eng_grp' could be null (see line 1256)

drivers/crypto/marvell/octeontx/otx_cptpf_ucode.c
  1255		mirrored_eng_grp = find_mirrored_eng_grp(eng_grp);
  1256		if (mirrored_eng_grp) {
                    ^^^^^^^^^^^^^^^^
The patch adds a check

  1257			/* Setup mirroring */
  1258			setup_eng_grp_mirroring(eng_grp, mirrored_eng_grp);
  1259	
  1260			/*
  1261			 * Update count of requested engines because some
  1262			 * of them might be shared with mirrored group
  1263			 */
  1264			update_requested_engs(mirrored_eng_grp, engs, engs_cnt);
  1265		}
  1266	
  1267		/* Reserve engines */
  1268		ret = reserve_engines(dev, eng_grp, engs, engs_cnt);
  1269		if (ret)
  1270			goto err_ucode_unload;
  1271	
  1272		/* Update ucode pointers used by engines */
  1273		update_ucode_ptrs(eng_grp);
  1274	
  1275		/* Update engine masks used by this group */
  1276		ret = eng_grp_update_masks(dev, eng_grp);
  1277		if (ret)
  1278			goto err_release_engs;
  1279	
  1280		/* Create sysfs entry for engine group info */
  1281		ret = create_sysfs_eng_grps_info(dev, eng_grp);
  1282		if (ret)
  1283			goto err_release_engs;
  1284	
  1285		/* Enable engine group */
  1286		ret = enable_eng_grp(eng_grp, eng_grps->obj);
  1287		if (ret)
  1288			goto err_release_engs;
  1289	
  1290		/*
  1291		 * If this engine group mirrors another engine group
  1292		 * then we need to unload ucode as we will use ucode
  1293		 * from mirrored engine group
  1294		 */
  1295		if (eng_grp->mirror.is_ena)
  1296			ucode_unload(dev, &eng_grp->ucode[0]);
  1297	
  1298		eng_grp->is_enabled = true;
  1299		if (eng_grp->mirror.is_ena)
  1300			dev_info(dev,
  1301				 "Engine_group%d: reuse microcode %s from group %d",
  1302				 eng_grp->idx, mirrored_eng_grp->ucode[0].ver_str,
                                               ^^^^^^^^^^^^^^^^^^
and an unchecked dereference.

regards,
dan carpenter

                 reply	other threads:[~2020-04-06 14:43 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=20200406144302.GC68494@mwanda \
    --to=dan.carpenter@oracle.com \
    --cc=linux-crypto@vger.kernel.org \
    --cc=schalla@marvell.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.