Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/external/bsd/common/include/linux Copy va_list before us...



details:   https://anonhg.NetBSD.org/src/rev/efacec70cd7c
branches:  trunk
changeset: 366160:efacec70cd7c
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Mon Aug 27 13:37:55 2018 +0000

description:
Copy va_list before using it twice.

diffstat:

 sys/external/bsd/common/include/linux/kernel.h |  7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

diffs (24 lines):

diff -r f93e637de4a7 -r efacec70cd7c sys/external/bsd/common/include/linux/kernel.h
--- a/sys/external/bsd/common/include/linux/kernel.h    Mon Aug 27 13:37:37 2018 +0000
+++ b/sys/external/bsd/common/include/linux/kernel.h    Mon Aug 27 13:37:55 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: kernel.h,v 1.19 2018/08/27 07:45:43 riastradh Exp $    */
+/*     $NetBSD: kernel.h,v 1.20 2018/08/27 13:37:55 riastradh Exp $    */
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -195,10 +195,13 @@
 static inline char *
 kvasprintf(gfp_t gfp, const char *fmt, va_list va)
 {
+       va_list tva;
        char *str;
        int len, len1 __diagused;
 
-       len = vsnprintf(NULL, 0, fmt, va);
+       va_copy(tva, va);
+       len = vsnprintf(NULL, 0, fmt, tva);
+       va_end(tva);
        str = kmalloc(len + 1, gfp);
        if (str == NULL)
                return NULL;



Home | Main Index | Thread Index | Old Index