From 0f0b081bb641bdfedce8cb4f0a9ca5088687f17b Mon Sep 17 00:00:00 2001 From: Fabian Keil Date: Tue, 14 Apr 2015 19:47:57 +0200 Subject: [PATCH] ggatec: In g_gatec_create(), don't pass stack garbage to the kernel Unbreaks ggatec 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, at least on my amd64 systems the uninitialized bytes the kernel cares about were always zero so everything worked as expected. Reported by ota@j.email.ne.jp in FreeBSD bug #197309. Obtained from: ElectroBSD --- sbin/ggate/ggatec/ggatec.c | 1 + 1 file changed, 1 insertion(+) diff --git a/sbin/ggate/ggatec/ggatec.c b/sbin/ggate/ggatec/ggatec.c index 6f9263c8..ea4f701 100644 --- a/sbin/ggate/ggatec/ggatec.c +++ b/sbin/ggate/ggatec/ggatec.c @@ -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; -- 2.3.0