projects
/
linux-2.6-microblaze.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
fs/epoll: rename check_events label to send_events
[linux-2.6-microblaze.git]
/
lib
/
seq_buf.c
diff --git
a/lib/seq_buf.c
b/lib/seq_buf.c
index
11f2ae0
..
bd807f5
100644
(file)
--- a/
lib/seq_buf.c
+++ b/
lib/seq_buf.c
@@
-140,13
+140,17
@@
int seq_buf_bprintf(struct seq_buf *s, const char *fmt, const u32 *binary)
*/
int seq_buf_puts(struct seq_buf *s, const char *str)
{
*/
int seq_buf_puts(struct seq_buf *s, const char *str)
{
-
unsigned in
t len = strlen(str);
+
size_
t len = strlen(str);
WARN_ON(s->size == 0);
WARN_ON(s->size == 0);
+ /* Add 1 to len for the trailing null byte which must be there */
+ len += 1;
+
if (seq_buf_can_fit(s, len)) {
memcpy(s->buffer + s->len, str, len);
if (seq_buf_can_fit(s, len)) {
memcpy(s->buffer + s->len, str, len);
- s->len += len;
+ /* Don't count the trailing null byte against the capacity */
+ s->len += len - 1;
return 0;
}
seq_buf_set_overflow(s);
return 0;
}
seq_buf_set_overflow(s);