From nobody@FreeBSD.org  Mon Apr 15 13:21:19 2013
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1])
	by hub.freebsd.org (Postfix) with ESMTP id 7E3C4281
	for <freebsd-gnats-submit@FreeBSD.org>; Mon, 15 Apr 2013 13:21:19 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from red.freebsd.org (red.freebsd.org [IPv6:2001:4f8:fff6::22])
	by mx1.freebsd.org (Postfix) with ESMTP id 6DE3CFE7
	for <freebsd-gnats-submit@FreeBSD.org>; Mon, 15 Apr 2013 13:21:19 +0000 (UTC)
Received: from red.freebsd.org (localhost [127.0.0.1])
	by red.freebsd.org (8.14.5/8.14.5) with ESMTP id r3FDLJD7083700
	for <freebsd-gnats-submit@FreeBSD.org>; Mon, 15 Apr 2013 13:21:19 GMT
	(envelope-from nobody@red.freebsd.org)
Received: (from nobody@localhost)
	by red.freebsd.org (8.14.5/8.14.5/Submit) id r3FDLJTG083699;
	Mon, 15 Apr 2013 13:21:19 GMT
	(envelope-from nobody)
Message-Id: <201304151321.r3FDLJTG083699@red.freebsd.org>
Date: Mon, 15 Apr 2013 13:21:19 GMT
From: Luiz Otavio O Souza <loos.br@gmail.com>
To: freebsd-gnats-submit@FreeBSD.org
Subject: [etherswitchcfg] [patch] uninitialized variable while setting port vlangroup
X-Send-Pr-Version: www-3.1
X-GNATS-Notify:

>Number:         177871
>Category:       bin
>Synopsis:       [patch] etherswitchcfg(8): uninitialized variable while setting port vlangroup
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-embedded
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Apr 15 13:30:00 UTC 2013
>Closed-Date:    Tue Aug 20 10:42:16 UTC 2013
>Last-Modified:  Tue Aug 20 10:42:16 UTC 2013
>Originator:     Luiz Otavio O Souza
>Release:        -HEAD r248943
>Organization:
>Environment:
FreeBSD rb433 10.0-CURRENT FreeBSD 10.0-CURRENT #88 r248943M: Sat Apr 13 10:04:43 BRT 2013     root@devel:/data/rb/rb433/obj/mips.mips/data/rb/rb433/src/sys/RB433U  mips
>Description:
etherswitchcfg(8) fails to set the vlangroup (similar to PVID) for a port because of an uninitialized variable.
>How-To-Repeat:
root@rb433:~ # etherswitchcfg vlangroup2 vlan 10 members 1,2
vlangroup2:
        vlan: 10
        members 1,2
root@rb433:~ # etherswitchcfg port2 vlangroup 2
etherswitchcfg: ioctl(IOETHERSWITCHGETPORT): Bad address

>Fix:
Apply the attached patch.

Patch attached with submission follows:

Index: sbin/etherswitchcfg/etherswitchcfg.c
===================================================================
--- sbin/etherswitchcfg/etherswitchcfg.c	(revision 248943)
+++ sbin/etherswitchcfg/etherswitchcfg.c	(working copy)
@@ -139,6 +139,7 @@
 	v = strtol(argv[1], NULL, 0);
 	if (v < 0 || v >= cfg->info.es_nvlangroups)
 		errx(EX_USAGE, "vlangroup must be between 0 and %d", cfg->info.es_nvlangroups-1);
+	bzero(&p, sizeof(p));
 	p.es_port = cfg->unit;
 	if (ioctl(cfg->fd, IOETHERSWITCHGETPORT, &p) != 0)
 		err(EX_OSERR, "ioctl(IOETHERSWITCHGETPORT)");


>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-bugs->freebsd-embedded 
Responsible-Changed-By: adrian 
Responsible-Changed-When: Fri Apr 19 17:51:46 UTC 2013 
Responsible-Changed-Why:  
Snarf. 


http://www.freebsd.org/cgi/query-pr.cgi?pr=177871 

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: bin/177871: commit references a PR
Date: Mon, 22 Apr 2013 05:27:21 +0000 (UTC)

 Author: adrian
 Date: Mon Apr 22 05:27:13 2013
 New Revision: 249747
 URL: http://svnweb.freebsd.org/changeset/base/249747
 
 Log:
   Initialise this to zero before using it to configure the vlangroup
   information.
   
   PR:		kern/177871
   Submitted by:	Luiz Otavio O Souza <loos.br@gmail.com>
 
 Modified:
   head/sbin/etherswitchcfg/etherswitchcfg.c
 
 Modified: head/sbin/etherswitchcfg/etherswitchcfg.c
 ==============================================================================
 --- head/sbin/etherswitchcfg/etherswitchcfg.c	Mon Apr 22 05:02:34 2013	(r249746)
 +++ head/sbin/etherswitchcfg/etherswitchcfg.c	Mon Apr 22 05:27:13 2013	(r249747)
 @@ -139,6 +139,7 @@ set_port_vlangroup(struct cfg *cfg, char
  	v = strtol(argv[1], NULL, 0);
  	if (v < 0 || v >= cfg->info.es_nvlangroups)
  		errx(EX_USAGE, "vlangroup must be between 0 and %d", cfg->info.es_nvlangroups-1);
 +	bzero(&p, sizeof(p));
  	p.es_port = cfg->unit;
  	if (ioctl(cfg->fd, IOETHERSWITCHGETPORT, &p) != 0)
  		err(EX_OSERR, "ioctl(IOETHERSWITCHGETPORT)");
 _______________________________________________
 svn-src-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/svn-src-all
 To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org"
 
State-Changed-From-To: open->closed 
State-Changed-By: sbruno 
State-Changed-When: Tue Aug 20 10:41:49 UTC 2013 
State-Changed-Why:  
Committed at svn r249747 

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