From owner-svn-src-head@FreeBSD.ORG Thu Oct 7 18:23:29 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 01A1C106566B; Thu, 7 Oct 2010 18:23:29 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C9ED78FC08; Thu, 7 Oct 2010 18:23:28 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o97INSPq050210; Thu, 7 Oct 2010 18:23:28 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o97INSLO050208; Thu, 7 Oct 2010 18:23:28 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201010071823.o97INSLO050208@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Thu, 7 Oct 2010 18:23:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213533 - head/sbin/hastd X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 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: Thu, 07 Oct 2010 18:23:29 -0000 Author: pjd Date: Thu Oct 7 18:23:28 2010 New Revision: 213533 URL: http://svn.freebsd.org/changeset/base/213533 Log: Clear ggate structures before using them. We don't initialize all the field and there can be some garbage from the stack. MFC after: 1 week Modified: head/sbin/hastd/primary.c Modified: head/sbin/hastd/primary.c ============================================================================== --- head/sbin/hastd/primary.c Thu Oct 7 18:20:51 2010 (r213532) +++ head/sbin/hastd/primary.c Thu Oct 7 18:23:28 2010 (r213533) @@ -238,6 +238,7 @@ cleanup(struct hast_resource *res) if (res->hr_ggateunit >= 0) { struct g_gate_ctl_destroy ggiod; + bzero(&ggiod, sizeof(ggiod)); ggiod.gctl_version = G_GATE_VERSION; ggiod.gctl_unit = res->hr_ggateunit; ggiod.gctl_force = 1; @@ -700,6 +701,7 @@ init_ggate(struct hast_resource *res) * Create provider before trying to connect, as connection failure * is not critical, but may take some time. */ + bzero(&ggiocreate, sizeof(ggiocreate)); ggiocreate.gctl_version = G_GATE_VERSION; ggiocreate.gctl_mediasize = res->hr_datasize; ggiocreate.gctl_sectorsize = res->hr_local_sectorsize; @@ -709,7 +711,6 @@ init_ggate(struct hast_resource *res) ggiocreate.gctl_unit = G_GATE_NAME_GIVEN; snprintf(ggiocreate.gctl_name, sizeof(ggiocreate.gctl_name), "hast/%s", res->hr_provname); - bzero(ggiocreate.gctl_info, sizeof(ggiocreate.gctl_info)); if (ioctl(res->hr_ggatefd, G_GATE_CMD_CREATE, &ggiocreate) == 0) { pjdlog_info("Device hast/%s created.", res->hr_provname); res->hr_ggateunit = ggiocreate.gctl_unit; @@ -727,6 +728,7 @@ init_ggate(struct hast_resource *res) * provider died and didn't clean up. In that case we will start from * where he left of. */ + bzero(&ggiocancel, sizeof(ggiocancel)); ggiocancel.gctl_version = G_GATE_VERSION; ggiocancel.gctl_unit = G_GATE_NAME_GIVEN; snprintf(ggiocancel.gctl_name, sizeof(ggiocancel.gctl_name), "hast/%s", @@ -928,6 +930,7 @@ ggate_recv_thread(void *arg) QUEUE_TAKE2(hio, free); pjdlog_debug(2, "ggate_recv: (%p) Got free request.", hio); ggio = &hio->hio_ggio; + bzero(ggio, sizeof(*ggio)); ggio->gctl_unit = res->hr_ggateunit; ggio->gctl_length = MAXPHYS; ggio->gctl_error = 0;