svn commit: r355343 - head/sys/mips/mips

Ryan Libby rlibby at FreeBSD.org
Tue Dec 3 17:43:53 UTC 2019


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);


More information about the svn-src-all mailing list