From: Dan Carpenter <dan.carpenter@oracle.com>
To: schalla@marvell.com
Cc: linux-crypto@vger.kernel.org
Subject: [bug report] crypto: octeontx2 - add apis for custom engine groups
Date: Wed, 15 Dec 2021 12:23:20 +0300 [thread overview]
Message-ID: <20211215092320.GA2732@kili> (raw)
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
reply other threads:[~2021-12-15 9:23 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=20211215092320.GA2732@kili \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox