[bug report] crypto: octeontx2 - add apis for custom engine groups

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

 



Hello Srujana Challa,

The patch d9d7749773e8: "crypto: octeontx2 - add apis for custom
engine groups" from Dec 1, 2021, leads to the following Smatch static
checker warning:

	drivers/crypto/marvell/octeontx2/otx2_cptpf_ucode.c:1807 otx2_cpt_print_uc_dbg_info()
	error: buffer overflow 'mask' 4 <= 4

drivers/crypto/marvell/octeontx2/otx2_cptpf_ucode.c
    1758 void otx2_cpt_print_uc_dbg_info(struct otx2_cptpf_dev *cptpf)
    1759 {
    1760         struct otx2_cpt_eng_grps *eng_grps = &cptpf->eng_grps;
    1761         struct otx2_cpt_eng_grp_info *mirrored_grp;
    1762         char engs_info[2 * OTX2_CPT_NAME_LENGTH];
    1763         struct otx2_cpt_eng_grp_info *grp;
    1764         struct otx2_cpt_engs_rsvd *engs;
    1765         u32 mask[4];
                 ^^^^^^^^^^^

    1766         int i, j;
    1767 
    1768         pr_debug("Engine groups global info");
    1769         pr_debug("max SE %d, max IE %d, max AE %d", eng_grps->avail.max_se_cnt,
    1770                  eng_grps->avail.max_ie_cnt, eng_grps->avail.max_ae_cnt);
    1771         pr_debug("free SE %d", eng_grps->avail.se_cnt);
    1772         pr_debug("free IE %d", eng_grps->avail.ie_cnt);
    1773         pr_debug("free AE %d", eng_grps->avail.ae_cnt);
    1774 
    1775         for (i = 0; i < OTX2_CPT_MAX_ENGINE_GROUPS; i++) {
    1776                 grp = &eng_grps->grp[i];
    1777                 pr_debug("engine_group%d, state %s", i,
    1778                          grp->is_enabled ? "enabled" : "disabled");
    1779                 if (grp->is_enabled) {
    1780                         mirrored_grp = &eng_grps->grp[grp->mirror.idx];
    1781                         pr_debug("Ucode0 filename %s, version %s",
    1782                                  grp->mirror.is_ena ?
    1783                                          mirrored_grp->ucode[0].filename :
    1784                                          grp->ucode[0].filename,
    1785                                  grp->mirror.is_ena ?
    1786                                          mirrored_grp->ucode[0].ver_str :
    1787                                          grp->ucode[0].ver_str);
    1788                         if (is_2nd_ucode_used(grp))
    1789                                 pr_debug("Ucode1 filename %s, version %s",
    1790                                          grp->ucode[1].filename,
    1791                                          grp->ucode[1].ver_str);
    1792                 }
    1793 
    1794                 for (j = 0; j < OTX2_CPT_MAX_ETYPES_PER_GRP; j++) {
    1795                         engs = &grp->engs[j];
    1796                         if (engs->type) {
    1797                                 get_engs_info(grp, engs_info,
    1798                                               2 * OTX2_CPT_NAME_LENGTH, j);
    1799                                 pr_debug("Slot%d: %s", j, engs_info);
    1800                                 bitmap_to_arr32(mask, engs->bmap,
    1801                                                 eng_grps->engs_num);
    1802                                 if (is_dev_otx2(cptpf->pdev))
    1803                                         pr_debug("Mask: %8.8x %8.8x %8.8x %8.8x",
    1804                                                  mask[3], mask[2], mask[1],
    1805                                                  mask[0]);
    1806                                 else
--> 1807                                         pr_debug("Mask: %8.8x %8.8x %8.8x %8.8x %8.8x",
    1808                                                  mask[4], mask[3], mask[2], mask[1],
                                                          ^^^^^^^
Out of bounds.

    1809                                                  mask[0]);
    1810                         }
    1811                 }
    1812         }
    1813 }

regards,
dan carpenter



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

  Powered by Linux