diff options
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/mod/modpost.c | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c index f70ff13d4818..b8b2a560b26b 100644 --- a/scripts/mod/modpost.c +++ b/scripts/mod/modpost.c | |||
@@ -508,12 +508,7 @@ buf_printf(struct buffer *buf, const char *fmt, ...) | |||
508 | 508 | ||
509 | va_start(ap, fmt); | 509 | va_start(ap, fmt); |
510 | len = vsnprintf(tmp, SZ, fmt, ap); | 510 | len = vsnprintf(tmp, SZ, fmt, ap); |
511 | if (buf->size - buf->pos < len + 1) { | 511 | buf_write(buf, tmp, len); |
512 | buf->size += 128; | ||
513 | buf->p = realloc(buf->p, buf->size); | ||
514 | } | ||
515 | strncpy(buf->p + buf->pos, tmp, len + 1); | ||
516 | buf->pos += len; | ||
517 | va_end(ap); | 512 | va_end(ap); |
518 | } | 513 | } |
519 | 514 | ||
@@ -521,7 +516,7 @@ void | |||
521 | buf_write(struct buffer *buf, const char *s, int len) | 516 | buf_write(struct buffer *buf, const char *s, int len) |
522 | { | 517 | { |
523 | if (buf->size - buf->pos < len) { | 518 | if (buf->size - buf->pos < len) { |
524 | buf->size += len; | 519 | buf->size += len + SZ; |
525 | buf->p = realloc(buf->p, buf->size); | 520 | buf->p = realloc(buf->p, buf->size); |
526 | } | 521 | } |
527 | strncpy(buf->p + buf->pos, s, len); | 522 | strncpy(buf->p + buf->pos, s, len); |