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/81a5dcbeb621
branches:  trunk
changeset: 992859:81a5dcbeb621
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 f3aa2d22f45b -r 81a5dcbeb621 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