netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 3/7] s390/qeth: Convert snprintf() to scnprintf()
@ 2022-09-26 18:42 Jules Irenge
  2022-09-27  0:33 ` Jakub Kicinski
  2022-09-27 14:27 ` Joe Perches
  0 siblings, 2 replies; 6+ messages in thread
From: Jules Irenge @ 2022-09-26 18:42 UTC (permalink / raw)
  To: borntraeger; +Cc: svens, linux-s390, netdev, linux-kernel, agordeev

Coccinnelle reports a warning
Warning: Use scnprintf or sprintf
Adding to that, there has been a slow migration from snprintf to scnprintf.
This LWN article explains the rationale for this change
https: //lwn.net/Articles/69419/
Ie. snprintf() returns what *would* be the resulting length,
while scnprintf() returns the actual length.

Signed-off-by: Jules Irenge <jbi.octave@gmail.com>
---
 drivers/s390/net/qeth_core_sys.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/s390/net/qeth_core_sys.c b/drivers/s390/net/qeth_core_sys.c
index 406be169173c..b40802d707a1 100644
--- a/drivers/s390/net/qeth_core_sys.c
+++ b/drivers/s390/net/qeth_core_sys.c
@@ -500,9 +500,9 @@ static ssize_t qeth_hw_trap_show(struct device *dev,
 	struct qeth_card *card = dev_get_drvdata(dev);
 
 	if (card->info.hwtrap)
-		return snprintf(buf, 5, "arm\n");
+		return scnprintf(buf, 5, "arm\n");
 	else
-		return snprintf(buf, 8, "disarm\n");
+		return scnprintf(buf, 8, "disarm\n");
 }
 
 static ssize_t qeth_hw_trap_store(struct device *dev,
-- 
2.37.3


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2022-09-28 23:04 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-09-26 18:42 [PATCH 3/7] s390/qeth: Convert snprintf() to scnprintf() Jules Irenge
2022-09-27  0:33 ` Jakub Kicinski
2022-09-27 13:31   ` Alexandra Winter
2022-09-27 14:27 ` Joe Perches
2022-09-28  8:24   ` Alexandra Winter
2022-09-28 23:04     ` Joe Perches

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).