All of lore.kernel.org
 help / color / mirror / Atom feed
* [bug report] crypto: marvell - add support for OCTEON TX CPT engine
@ 2020-04-06 14:43 Dan Carpenter
  0 siblings, 0 replies; only message in thread
From: Dan Carpenter @ 2020-04-06 14:43 UTC (permalink / raw)
  To: schalla; +Cc: SrujanaChalla, linux-crypto

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2020-04-06 14:43 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-04-06 14:43 [bug report] crypto: marvell - add support for OCTEON TX CPT engine Dan Carpenter

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.