From owner-svn-src-head@FreeBSD.ORG Sat Dec 22 01:04:29 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id CEDCB354; Sat, 22 Dec 2012 01:04:29 +0000 (UTC) (envelope-from cognet@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id B3B958FC12; Sat, 22 Dec 2012 01:04:29 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qBM14Tn7075612; Sat, 22 Dec 2012 01:04:29 GMT (envelope-from cognet@svn.freebsd.org) Received: (from cognet@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qBM14Tnc075611; Sat, 22 Dec 2012 01:04:29 GMT (envelope-from cognet@svn.freebsd.org) Message-Id: <201212220104.qBM14Tnc075611@svn.freebsd.org> From: Olivier Houchard Date: Sat, 22 Dec 2012 01:04:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r244575 - head/sys/arm/arm X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 22 Dec 2012 01:04:29 -0000 Author: cognet Date: Sat Dec 22 01:04:29 2012 New Revision: 244575 URL: http://svnweb.freebsd.org/changeset/base/244575 Log: The manpage states that bus_dmamap_create(9) returns ENOMEM if it can't allocate a map or mapping resources. That seems to imply that any memory allocations it does must use M_NOWAIT and check for NULL. Submitted by: Ian Lepore Modified: head/sys/arm/arm/busdma_machdep.c Modified: head/sys/arm/arm/busdma_machdep.c ============================================================================== --- head/sys/arm/arm/busdma_machdep.c Sat Dec 22 01:03:23 2012 (r244574) +++ head/sys/arm/arm/busdma_machdep.c Sat Dec 22 01:04:29 2012 (r244575) @@ -567,16 +567,24 @@ bus_dmamap_create(bus_dma_tag_t dmat, in bus_dmamap_t map; int error = 0; - map = uma_zalloc_arg(dmamap_zone, dmat, M_WAITOK); + map = uma_zalloc_arg(dmamap_zone, dmat, M_NOWAIT); *mapp = map; + if (map == NULL) + return (ENOMEM); /* * If the tag's segments haven't been allocated yet we need to do it * now, because we can't sleep for resources at map load time. */ - if (dmat->segments == NULL) + if (dmat->segments == NULL) { dmat->segments = malloc(dmat->nsegments * - sizeof(*dmat->segments), M_DEVBUF, M_WAITOK); + sizeof(*dmat->segments), M_DEVBUF, M_NOWAIT); + if (dmat->segments == NULL) { + uma_zfree(dmamap_zone, map); + *mapp = NULL; + return (ENOMEM); + } + } /* * Bouncing might be required if the driver asks for an active