From mboxrd@z Thu Jan 1 00:00:00 1970 Content-Type: multipart/mixed; boundary="===============3867284920496917585==" MIME-Version: 1.0 From: kernel test robot Subject: [PATCH] coccinelle: api: fix device_attr_show.cocci warnings Date: Fri, 20 Nov 2020 19:52:32 +0800 Message-ID: <20201120115232.GA76564@abf1b851c7ab> In-Reply-To: <202011201915.hXCSOW3C-lkp@intel.com> List-Id: To: kbuild@lists.01.org --===============3867284920496917585== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable CC: kbuild-all(a)lists.01.org CC: linux-kernel(a)vger.kernel.org TO: Denis Efremov CC: Julia Lawall CC: Jamie Iles CC: Herbert Xu CC: linux-arm-kernel(a)lists.infradead.org CC: linux-crypto(a)vger.kernel.org CC: linux-kernel(a)vger.kernel.org From: kernel test robot drivers/crypto/picoxcell_crypto.c:1200:8-16: WARNING: use scnprintf or spri= ntf From Documentation/filesystems/sysfs.txt: show() must not use snprintf() when formatting the value to be returned to user space. If you can guarantee that an overflow will never happen you can use sprintf() otherwise you must use scnprintf(). Generated by: scripts/coccinelle/api/device_attr_show.cocci Fixes: abfc19ff202d ("coccinelle: api: add device_attr_show script") CC: Denis Efremov Reported-by: kernel test robot Signed-off-by: kernel test robot --- tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git = master head: 4d02da974ea85a62074efedf354e82778f910d82 commit: abfc19ff202d287742483e15fd478ddd6ada2187 coccinelle: api: add devic= e_attr_show script :::::: branch date: 14 hours ago :::::: commit date: 4 months ago Please take the patch only if it's a positive warning. Thanks! picoxcell_crypto.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/crypto/picoxcell_crypto.c +++ b/drivers/crypto/picoxcell_crypto.c @@ -1197,7 +1197,7 @@ static ssize_t spacc_stat_irq_thresh_sho { struct spacc_engine *engine =3D spacc_dev_to_engine(dev); = - return snprintf(buf, PAGE_SIZE, "%u\n", engine->stat_irq_thresh); + return scnprintf(buf, PAGE_SIZE, "%u\n", engine->stat_irq_thresh); } = static ssize_t spacc_stat_irq_thresh_store(struct device *dev, --===============3867284920496917585==--