Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 3 Dec 2019 17:43:53 +0000 (UTC)
From:      Ryan Libby <rlibby@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r355343 - head/sys/mips/mips
Message-ID:  <201912031743.xB3HhrVN025339@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: rlibby
Date: Tue Dec  3 17:43:52 2019
New Revision: 355343
URL: https://svnweb.freebsd.org/changeset/base/355343

Log:
  mips busdma: bzero map on alloc
  
  Maps from the mips busdma dmamap_zone were not completely initialized.
  In particular, pagesneeded and pagesreserved were not initialized.  This
  could cause a crash.
  
  Remove some dead fields from mips struct bus_dmamap while here.
  
  Reported by:	brooks
  Reviewed by:	ian
  Sponsored by:	Dell EMC Isilon
  Differential Revision:	https://reviews.freebsd.org/D22638

Modified:
  head/sys/mips/mips/busdma_machdep.c

Modified: head/sys/mips/mips/busdma_machdep.c
==============================================================================
--- head/sys/mips/mips/busdma_machdep.c	Tue Dec  3 17:06:48 2019	(r355342)
+++ head/sys/mips/mips/busdma_machdep.c	Tue Dec  3 17:43:52 2019	(r355343)
@@ -156,8 +156,6 @@ struct bus_dmamap {
 	bus_dma_tag_t	dmat;
 	struct memdesc	mem;
 	int		flags;
-	void		*origbuffer;
-	void		*allocbuffer;
 	TAILQ_ENTRY(bus_dmamap)	freelist;
 	STAILQ_ENTRY(bus_dmamap) links;
 	bus_dmamap_callback_t *callback;
@@ -205,11 +203,8 @@ dmamap_ctor(void *mem, int size, void *arg, int flags)
 
 	dmat->map_count++;
 
+	bzero(map, sizeof(*map));
 	map->dmat = dmat;
-	map->flags = 0;
-	map->slist = NULL;
-	map->allocbuffer = NULL;
-	map->sync_count = 0;
 	STAILQ_INIT(&map->bpages);
 
 	return (0);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201912031743.xB3HhrVN025339>