mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Chen Zhou <chenzhou10@huawei.com>
To: <heiko.carstens@de.ibm.com>, <gor@linux.ibm.com>,
	<borntraeger@de.ibm.com>
Cc: <linux-s390@vger.kernel.or>, <linux-kernel@vger.kernel.org>,
	<chenzhou10@huawei.com>
Subject: [PATCH -next 2/3] s390: use scnprintf() in sys_##_prefix##_##_name##_show
Date: Sat, 9 May 2020 16:56:07 +0800	[thread overview]
Message-ID: <20200509085608.41061-3-chenzhou10@huawei.com> (raw)
In-Reply-To: <20200509085608.41061-1-chenzhou10@huawei.com>

snprintf() returns the number of bytes that would be written,
which may be greater than the the actual length to be written.

show() methods should return the number of bytes printed into the
buffer. This is the return value of scnprintf().

Signed-off-by: Chen Zhou <chenzhou10@huawei.com>
---
 arch/s390/kernel/ipl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/s390/kernel/ipl.c b/arch/s390/kernel/ipl.c
index ccea9a245867..90a2a17239b0 100644
--- a/arch/s390/kernel/ipl.c
+++ b/arch/s390/kernel/ipl.c
@@ -181,7 +181,7 @@ static ssize_t sys_##_prefix##_##_name##_show(struct kobject *kobj,	\
 		struct kobj_attribute *attr,				\
 		char *page)						\
 {									\
-	return snprintf(page, PAGE_SIZE, _format, ##args);		\
+	return scnprintf(page, PAGE_SIZE, _format, ##args);		\
 }
 
 #define IPL_ATTR_CCW_STORE_FN(_prefix, _name, _ipl_blk)			\
-- 
2.20.1


  parent reply	other threads:[~2020-05-09  8:52 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-09  8:56 [PATCH -next 0/3] s390: use scnprintf() in show() methods Chen Zhou
2020-05-09  8:56 ` [PATCH -next 1/3] s390/crypto: use scnprintf() instead of snprintf() Chen Zhou
2020-05-09  8:56 ` Chen Zhou [this message]
2020-05-09  8:56 ` [PATCH -next 3/3] s390/protvirt: " Chen Zhou
2020-06-08 14:25 ` [PATCH -next 0/3] s390: use scnprintf() in show() methods Heiko Carstens

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=20200509085608.41061-3-chenzhou10@huawei.com \
    --to=chenzhou10@huawei.com \
    --cc=borntraeger@de.ibm.com \
    --cc=gor@linux.ibm.com \
    --cc=heiko.carstens@de.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-s390@vger.kernel.or \
    /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

all inboxes | Powered by JetHome®