From owner-svn-src-all@freebsd.org Sun Jan 7 13:41:07 2018 Return-Path: Delivered-To: svn-src-all@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 A1CA2E6DFF3; Sun, 7 Jan 2018 13:41:07 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 7B93C3FCE; Sun, 7 Jan 2018 13:41:07 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id AD6CA21DF9; Sun, 7 Jan 2018 13:41:06 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w07Df6ID070846; Sun, 7 Jan 2018 13:41:06 GMT (envelope-from kp@FreeBSD.org) Received: (from kp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w07Df62R070845; Sun, 7 Jan 2018 13:41:06 GMT (envelope-from kp@FreeBSD.org) Message-Id: <201801071341.w07Df62R070845@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kp set sender to kp@FreeBSD.org using -f From: Kristof Provost Date: Sun, 7 Jan 2018 13:41:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r327677 - head/sys/contrib/vchiq/interface/compat X-SVN-Group: head X-SVN-Commit-Author: kp X-SVN-Commit-Paths: head/sys/contrib/vchiq/interface/compat X-SVN-Commit-Revision: 327677 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 07 Jan 2018 13:41:07 -0000 Author: kp Date: Sun Jan 7 13:41:06 2018 New Revision: 327677 URL: https://svnweb.freebsd.org/changeset/base/327677 Log: vchiq: Use mallocarray() to provide kcalloc() This means we now also provide integer overflow protection, like the Linux kcalloc(). Modified: head/sys/contrib/vchiq/interface/compat/vchi_bsd.h Modified: head/sys/contrib/vchiq/interface/compat/vchi_bsd.h ============================================================================== --- head/sys/contrib/vchiq/interface/compat/vchi_bsd.h Sun Jan 7 13:39:12 2018 (r327676) +++ head/sys/contrib/vchiq/interface/compat/vchi_bsd.h Sun Jan 7 13:41:06 2018 (r327677) @@ -329,7 +329,8 @@ device_rlprintf(int pps, device_t dev, const char *fmt MALLOC_DECLARE(M_VCHI); #define kmalloc(size, flags) malloc((size), M_VCHI, M_NOWAIT | M_ZERO) -#define kcalloc(n, size, flags) malloc((n) * (size), M_VCHI, M_NOWAIT | M_ZERO) +#define kcalloc(n, size, flags) mallocarray((n), (size), M_VCHI, \ + M_NOWAIT | M_ZERO) #define kzalloc(a, b) kcalloc(1, (a), (b)) #define kfree(p) free(p, M_VCHI)