CC: kbuild-all(a)lists.01.org CC: linux-kernel(a)vger.kernel.org TO: Denis Efremov CC: Julia Lawall CC: Jonathan Cameron CC: Hartmut Knaack CC: "Lars-Peter Clausen" CC: "Peter Meerwald-Stadler" CC: Maxime Coquelin CC: Alexandre Torgue CC: Fabrice Gasnier CC: linux-iio(a)vger.kernel.org From: kernel test robot drivers/iio/trigger/stm32-timer-trigger.c:299:8-16: WARNING: use scnprintf or sprintf 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: d5beb3140f91b1c8a3d41b14d729aefa4dcc58bc commit: abfc19ff202d287742483e15fd478ddd6ada2187 coccinelle: api: add device_attr_show script :::::: branch date: 21 hours ago :::::: commit date: 4 months ago Please take the patch only if it's a positive warning. Thanks! stm32-timer-trigger.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/iio/trigger/stm32-timer-trigger.c +++ b/drivers/iio/trigger/stm32-timer-trigger.c @@ -296,7 +296,7 @@ static ssize_t stm32_tt_show_master_mode else cr2 = (cr2 & TIM_CR2_MMS) >> TIM_CR2_MMS_SHIFT; - return snprintf(buf, PAGE_SIZE, "%s\n", master_mode_table[cr2]); + return scnprintf(buf, PAGE_SIZE, "%s\n", master_mode_table[cr2]); } static ssize_t stm32_tt_store_master_mode(struct device *dev,