* [PATCH v3 1/3] pstore: use scnprintf
@ 2015-01-06 19:18 Mark Salyzyn
2015-01-07 2:25 ` Joe Perches
0 siblings, 1 reply; 3+ messages in thread
From: Mark Salyzyn @ 2015-01-06 19:18 UTC (permalink / raw)
To: linux-kernel
Cc: Mark Salyzyn, Anton Vorontsov, Colin Cross, Kees Cook, Tony Luck
No guarantees that the names will not exceed the
name buffer with future adjustments.
Signed-off-by: Mark Salyzyn <salyzyn@android.com>
---
fs/pstore/inode.c | 23 +++++++++++++----------
1 file changed, 13 insertions(+), 10 deletions(-)
diff --git a/fs/pstore/inode.c b/fs/pstore/inode.c
index 5041660..d69586f 100644
--- a/fs/pstore/inode.c
+++ b/fs/pstore/inode.c
@@ -338,32 +338,35 @@ int pstore_mkfile(enum pstore_type_id type, char *psname, u64 id, int count,
switch (type) {
case PSTORE_TYPE_DMESG:
- sprintf(name, "dmesg-%s-%lld%s", psname, id,
- compressed ? ".enc.z" : "");
+ scnprintf(name, sizeof(name), "dmesg-%s-%lld%s",
+ psname, id, compressed ? ".enc.z" : "");
break;
case PSTORE_TYPE_CONSOLE:
- sprintf(name, "console-%s-%lld", psname, id);
+ scnprintf(name, sizeof(name), "console-%s-%lld", psname, id);
break;
case PSTORE_TYPE_FTRACE:
- sprintf(name, "ftrace-%s-%lld", psname, id);
+ scnprintf(name, sizeof(name), "ftrace-%s-%lld", psname, id);
break;
case PSTORE_TYPE_MCE:
- sprintf(name, "mce-%s-%lld", psname, id);
+ scnprintf(name, sizeof(name), "mce-%s-%lld", psname, id);
break;
case PSTORE_TYPE_PPC_RTAS:
- sprintf(name, "rtas-%s-%lld", psname, id);
+ scnprintf(name, sizeof(name), "rtas-%s-%lld", psname, id);
break;
case PSTORE_TYPE_PPC_OF:
- sprintf(name, "powerpc-ofw-%s-%lld", psname, id);
+ scnprintf(name, sizeof(name), "powerpc-ofw-%s-%lld",
+ psname, id);
break;
case PSTORE_TYPE_PPC_COMMON:
- sprintf(name, "powerpc-common-%s-%lld", psname, id);
+ scnprintf(name, sizeof(name), "powerpc-common-%s-%lld",
+ psname, id);
break;
case PSTORE_TYPE_UNKNOWN:
- sprintf(name, "unknown-%s-%lld", psname, id);
+ scnprintf(name, sizeof(name), "unknown-%s-%lld", psname, id);
break;
default:
- sprintf(name, "type%d-%s-%lld", type, psname, id);
+ scnprintf(name, sizeof(name), "type%d-%s-%lld",
+ type, psname, id);
break;
}
--
2.2.0.rc0.207.ga3a616c
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH v3 1/3] pstore: use scnprintf
2015-01-06 19:18 [PATCH v3 1/3] pstore: use scnprintf Mark Salyzyn
@ 2015-01-07 2:25 ` Joe Perches
2015-01-07 15:47 ` Mark Salyzyn
0 siblings, 1 reply; 3+ messages in thread
From: Joe Perches @ 2015-01-07 2:25 UTC (permalink / raw)
To: Mark Salyzyn
Cc: linux-kernel, Anton Vorontsov, Colin Cross, Kees Cook, Tony Luck
On Tue, 2015-01-06 at 11:18 -0800, Mark Salyzyn wrote:
> No guarantees that the names will not exceed the
> name buffer with future adjustments.
It'd be nice to describe the changes between versions.
Typically, it's done after the --- line separating the
changelog and sign-off and the patch.
cheers, Joe
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v3 1/3] pstore: use scnprintf
2015-01-07 2:25 ` Joe Perches
@ 2015-01-07 15:47 ` Mark Salyzyn
0 siblings, 0 replies; 3+ messages in thread
From: Mark Salyzyn @ 2015-01-07 15:47 UTC (permalink / raw)
To: Joe Perches
Cc: linux-kernel, Anton Vorontsov, Colin Cross, Kees Cook, Tony Luck
On 01/06/2015 06:25 PM, Joe Perches wrote:
> It'd be nice to describe the changes between versions.
>
> Typically, it's done after the --- line separating the
> changelog and sign-off and the patch.
>
> cheers, Joe
Thanks.
For the record:
Original: used snprintf
V2: switched to scnprintf, but one line-wrap had an embedded space
V3: dropped the embedded space (inert)
Used git-email for submissions for the first time, consider the lack of
comment learning a new workflow (its been a few years since my last
submissions, forgive me gohd, for I have sinned)
Sincerely -- Mark Salyzyn
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2015-01-07 15:47 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-01-06 19:18 [PATCH v3 1/3] pstore: use scnprintf Mark Salyzyn
2015-01-07 2:25 ` Joe Perches
2015-01-07 15:47 ` Mark Salyzyn
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).