From owner-svn-src-stable-9@freebsd.org Tue Jul 21 16:53:47 2015 Return-Path: Delivered-To: svn-src-stable-9@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 382989A7E81; Tue, 21 Jul 2015 16:53:47 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0317110AD; Tue, 21 Jul 2015 16:53:47 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6LGrkgE050635; Tue, 21 Jul 2015 16:53:46 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6LGrkJ8050633; Tue, 21 Jul 2015 16:53:46 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201507211653.t6LGrkJ8050633@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Tue, 21 Jul 2015 16:53:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r285757 - stable/9/sys/ofed/include/linux X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Jul 2015 16:53:47 -0000 Author: hselasky Date: Tue Jul 21 16:53:45 2015 New Revision: 285757 URL: https://svnweb.freebsd.org/changeset/base/285757 Log: MFC r285088: Fix broken implementation of "kvasprintf()" function by adding missing kmalloc() call. Make function global instead of static inline to fix compiler warnings about passing variable argument lists to inline functions. Sponsored by: Mellanox Technologies Requested by: markj @ Modified: stable/9/sys/ofed/include/linux/device.h stable/9/sys/ofed/include/linux/linux_compat.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/ofed/include/linux/device.h ============================================================================== --- stable/9/sys/ofed/include/linux/device.h Tue Jul 21 15:50:14 2015 (r285756) +++ stable/9/sys/ofed/include/linux/device.h Tue Jul 21 16:53:45 2015 (r285757) @@ -416,21 +416,7 @@ static inline int dev_to_node(struct dev return -1; } -static inline char *kvasprintf(gfp_t gfp, const char *fmt, va_list ap) -{ - unsigned int len; - char *p = NULL; - va_list aq; - - va_copy(aq, ap); - len = vsnprintf(NULL, 0, fmt, aq); - va_end(aq); - - vsnprintf(p, len+1, fmt, ap); - - return p; -} - +char *kvasprintf(gfp_t, const char *, va_list); char *kasprintf(gfp_t, const char *, ...); #endif /* _LINUX_DEVICE_H_ */ Modified: stable/9/sys/ofed/include/linux/linux_compat.c ============================================================================== --- stable/9/sys/ofed/include/linux/linux_compat.c Tue Jul 21 15:50:14 2015 (r285756) +++ stable/9/sys/ofed/include/linux/linux_compat.c Tue Jul 21 16:53:45 2015 (r285757) @@ -689,6 +689,23 @@ vunmap(void *addr) kfree(vmmap); } +char * +kvasprintf(gfp_t gfp, const char *fmt, va_list ap) +{ + unsigned int len; + char *p; + va_list aq; + + va_copy(aq, ap); + len = vsnprintf(NULL, 0, fmt, aq); + va_end(aq); + + p = kmalloc(len + 1, gfp); + if (p != NULL) + vsnprintf(p, len + 1, fmt, ap); + + return (p); +} char * kasprintf(gfp_t gfp, const char *fmt, ...) @@ -700,7 +717,7 @@ kasprintf(gfp_t gfp, const char *fmt, .. p = kvasprintf(gfp, fmt, ap); va_end(ap); - return p; + return (p); } static int