From nobody@FreeBSD.org  Mon Jun  7 15:50:54 2010
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id D39A01065677
	for <freebsd-gnats-submit@FreeBSD.org>; Mon,  7 Jun 2010 15:50:54 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (www.freebsd.org [IPv6:2001:4f8:fff6::21])
	by mx1.freebsd.org (Postfix) with ESMTP id C2A928FC1F
	for <freebsd-gnats-submit@FreeBSD.org>; Mon,  7 Jun 2010 15:50:54 +0000 (UTC)
Received: from www.freebsd.org (localhost [127.0.0.1])
	by www.freebsd.org (8.14.3/8.14.3) with ESMTP id o57Fosgk039015
	for <freebsd-gnats-submit@FreeBSD.org>; Mon, 7 Jun 2010 15:50:54 GMT
	(envelope-from nobody@www.freebsd.org)
Received: (from nobody@localhost)
	by www.freebsd.org (8.14.3/8.14.3/Submit) id o57Fosb9039014;
	Mon, 7 Jun 2010 15:50:54 GMT
	(envelope-from nobody)
Message-Id: <201006071550.o57Fosb9039014@www.freebsd.org>
Date: Mon, 7 Jun 2010 15:50:54 GMT
From: Garrett Cooper <yaneurabeya@gmail.com>
To: freebsd-gnats-submit@FreeBSD.org
Subject: [patch] fix unitialized mfi_unit value passed to mfiutil(8) / mptutil(8)
X-Send-Pr-Version: www-3.1
X-GNATS-Notify:

>Number:         147654
>Category:       bin
>Synopsis:       [patch] fix unitialized mfi_unit value passed to mfiutil(8) / mptutil(8)
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Jun 07 16:00:17 UTC 2010
>Closed-Date:    Mon Jun 07 18:51:29 UTC 2010
>Last-Modified:  Sun Feb 03 22:28:57 UTC 2013
>Originator:     Garrett Cooper
>Release:        9-CURRENT
>Organization:
Cisco Systems, Inc.
>Environment:
FreeBSD bayonetta.local 9.0-CURRENT FreeBSD 9.0-CURRENT #0 r206173M: Mon Apr 26 22:45:06 PDT 2010     root@bayonetta.local:/usr/obj/usr/src/sys/BAYONETTA.ata  amd64
>Description:
The value of mpt_unit can be undefined (depending on how the stack is allocated) if -u isn't passed to the command. This patch explicitly notes that the default mpt_unit is unit 0 in both mfiutil(8) and mptutil(8).
>How-To-Repeat:

>Fix:


Patch attached with submission follows:

Index: mfiutil/mfiutil.c
===================================================================
--- mfiutil/mfiutil.c	(revision 206173)
+++ mfiutil/mfiutil.c	(working copy)
@@ -43,7 +43,7 @@
 MFI_TABLE(top, stop);
 MFI_TABLE(top, abort);
 
-int mfi_unit;
+int mfi_unit = 0;
 
 static void
 usage(void)
Index: mptutil/mptutil.c
===================================================================
--- mptutil/mptutil.c	(revision 206173)
+++ mptutil/mptutil.c	(working copy)
@@ -42,7 +42,7 @@
 
 SET_DECLARE(MPT_DATASET(top), struct mptutil_command);
 
-int mpt_unit;
+int mpt_unit = 0;
 
 static void
 usage(void)


>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->closed 
State-Changed-By: jh 
State-Changed-When: Mon Jun 7 18:47:36 UTC 2010 
State-Changed-Why:  
Global variables are automatically initialized to zero. There is no need 
for the patch. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=147654 
>Unformatted:
