svn commit: r285531 - in head/sbin/ggate: ggatec ggatel

Christian Brueffer brueffer at FreeBSD.org
Tue Jul 14 10:49:37 UTC 2015


Author: brueffer
Date: Tue Jul 14 10:49:36 2015
New Revision: 285531
URL: https://svnweb.freebsd.org/changeset/base/285531

Log:
  Unbreak ggatec and ggatel on i386 after r238119, which added two more
  'struct g_gate_ctl_create' fields.
  
  While the behaviour was technically undefined on other architectures
  as well, on the reporter's amd64 systems the uninitialized bytes the
  kernel cares about were always zero so everything worked as expected.
  
  PR:		197309, 199559
  Submitted by:	ota at j.email.ne.jp, Fabian Keil
  Reviewed by:	pjd
  MFC after:	1 week

Modified:
  head/sbin/ggate/ggatec/ggatec.c
  head/sbin/ggate/ggatel/ggatel.c

Modified: head/sbin/ggate/ggatec/ggatec.c
==============================================================================
--- head/sbin/ggate/ggatec/ggatec.c	Tue Jul 14 10:47:56 2015	(r285530)
+++ head/sbin/ggate/ggatec/ggatec.c	Tue Jul 14 10:49:36 2015	(r285531)
@@ -447,6 +447,7 @@ g_gatec_create(void)
 	/*
 	 * Ok, got both sockets, time to create provider.
 	 */
+	memset(&ggioc, 0, sizeof(ggioc));
 	ggioc.gctl_version = G_GATE_VERSION;
 	ggioc.gctl_mediasize = mediasize;
 	ggioc.gctl_sectorsize = sectorsize;

Modified: head/sbin/ggate/ggatel/ggatel.c
==============================================================================
--- head/sbin/ggate/ggatel/ggatel.c	Tue Jul 14 10:47:56 2015	(r285530)
+++ head/sbin/ggate/ggatel/ggatel.c	Tue Jul 14 10:49:36 2015	(r285531)
@@ -173,6 +173,7 @@ g_gatel_create(void)
 	fd = open(path, g_gate_openflags(flags) | O_DIRECT | O_FSYNC);
 	if (fd == -1)
 		err(EXIT_FAILURE, "Cannot open %s", path);
+	memset(&ggioc, 0, sizeof(ggioc));
 	ggioc.gctl_version = G_GATE_VERSION;
 	ggioc.gctl_unit = unit;
 	ggioc.gctl_mediasize = g_gate_mediasize(fd);


More information about the svn-src-all mailing list