From nobody@FreeBSD.org  Mon Nov 26 08:35:26 2012
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id 4240055E
	for <freebsd-gnats-submit@FreeBSD.org>; Mon, 26 Nov 2012 08:35:26 +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 28C348FC08
	for <freebsd-gnats-submit@FreeBSD.org>; Mon, 26 Nov 2012 08:35:26 +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 qAQ8ZQpi093383
	for <freebsd-gnats-submit@FreeBSD.org>; Mon, 26 Nov 2012 08:35:26 GMT
	(envelope-from nobody@red.freebsd.org)
Received: (from nobody@localhost)
	by red.freebsd.org (8.14.5/8.14.5/Submit) id qAQ8ZQxr093382;
	Mon, 26 Nov 2012 08:35:26 GMT
	(envelope-from nobody)
Message-Id: <201211260835.qAQ8ZQxr093382@red.freebsd.org>
Date: Mon, 26 Nov 2012 08:35:26 GMT
From: Garrett Cooper <yaneurabeya@gmail.com>
To: freebsd-gnats-submit@FreeBSD.org
Subject: [patch] Fix compilation errors when -Werror specified in sys/boot/Makefile.inc
X-Send-Pr-Version: www-3.1
X-GNATS-Notify:

>Number:         173932
>Category:       kern
>Synopsis:       [boot] [patch] Fix compilation errors when -Werror specified in sys/boot/Makefile.inc
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Nov 26 08:40:01 UTC 2012
>Closed-Date:    
>Last-Modified:  Sun Mar 10 05:19:25 UTC 2013
>Originator:     Garrett Cooper
>Release:        9-STABLE
>Organization:
EMC Isilon
>Environment:
FreeBSD bayonetta.local 9.1-PRERELEASE FreeBSD 9.1-PRERELEASE #0 r240836M: Sat Sep 22 12:30:11 PDT 2012     gcooper@bayonetta.local:/usr/obj/store/freebsd/stable/9/sys/BAYONETTA  amd64
>Description:
In order to catch errors for warnings I added -Werror to sys/boot/Makefile.inc, and I found a few issues. The attached patch resolves the warnings on amd64; I'm running a make tinderbox -DMAKE_JUST_WORLDS to validate that the changes are ok on other architectures as well.
>How-To-Repeat:

>Fix:


Patch attached with submission follows:

Index: sys/boot/Makefile.inc
===================================================================
--- sys/boot/Makefile.inc	(revision 243557)
+++ sys/boot/Makefile.inc	(working copy)
@@ -1,3 +1,5 @@
 # $FreeBSD$
 
 SSP_CFLAGS=
+
+CFLAGS+=	-Werror
Index: sys/boot/common/dev_net.c
===================================================================
--- sys/boot/common/dev_net.c	(revision 243557)
+++ sys/boot/common/dev_net.c	(working copy)
@@ -325,11 +325,10 @@
 #endif
 
 	d = socktodesc(sock);
-	sprintf(temp, "%6D", d->myea, ":");
 	setenv("boot.netif.ip", inet_ntoa(myip), 1);
 	setenv("boot.netif.netmask", intoa(netmask), 1);
 	setenv("boot.netif.gateway", inet_ntoa(gateip), 1);
-	setenv("boot.netif.hwaddr", temp, 1);
+	setenv("boot.netif.hwaddr", ether_sprintf(d->myea), 1);
 	setenv("boot.nfsroot.server", inet_ntoa(rootip), 1);
 	setenv("boot.nfsroot.path", rootpath, 1);
 
Index: sys/boot/common/module.c
===================================================================
--- sys/boot/common/module.c	(revision 243557)
+++ sys/boot/common/module.c	(working copy)
@@ -729,7 +729,7 @@
 	intp = (int*)recptr;
 	reclen = *intp++;
 	ival = *intp++;
-	cp = (char*)intp;
+	cp = (u_char*)intp;
 	switch (ival) {
 	case MDT_VERSION:
 	    clen = *cp++;
@@ -761,9 +761,9 @@
      * Finally check if KLD is in the place
      */
     if (found)
-	result = file_lookup(mdp->d_path, cp, clen, NULL);
+	result = file_lookup(mdp->d_path, (char*)cp, clen, NULL);
     else if (best)
-	result = file_lookup(mdp->d_path, best, blen, NULL);
+	result = file_lookup(mdp->d_path, (char*)best, blen, NULL);
 bad:
     /*
      * If nothing found or hints is absent - fallback to the old way
Index: sys/boot/efi/libefi/efipart.c
===================================================================
--- sys/boot/efi/libefi/efipart.c	(revision 243557)
+++ sys/boot/efi/libefi/efipart.c	(working copy)
@@ -87,7 +87,8 @@
 	nout = 0;
 
 	for (n = 0; n < nin; n++) {
-		status = BS->HandleProtocol(hin[n], &blkio_guid, &blkio);
+		status = BS->HandleProtocol(hin[n], &blkio_guid,
+			    (VOID**)&blkio);
 		if (EFI_ERROR(status))
 			continue;
 		if (!blkio->Media->LogicalPartition)
@@ -115,7 +116,7 @@
 		sprintf(line, "    %s%d:", efipart_dev.dv_name, unit);
 		pager_output(line);
 
-		status = BS->HandleProtocol(h, &blkio_guid, &blkio);
+		status = BS->HandleProtocol(h, &blkio_guid, (VOID**)&blkio);
 		if (!EFI_ERROR(status)) {
 			sprintf(line, "    %llu blocks",
 			    (unsigned long long)(blkio->Media->LastBlock + 1));
@@ -144,7 +145,7 @@
 	if (h == NULL)
 		return (EINVAL);
 
-	status = BS->HandleProtocol(h, &blkio_guid, &blkio);
+	status = BS->HandleProtocol(h, &blkio_guid, (VOID**)&blkio);
 	if (EFI_ERROR(status))
 		return (efi_status_to_errno(status));
 
Index: sys/boot/i386/libi386/devicename.c
===================================================================
--- sys/boot/i386/libi386/devicename.c	(revision 243557)
+++ sys/boot/i386/libi386/devicename.c	(working copy)
@@ -127,9 +127,8 @@
 		err = EUNIT;
 		goto fail;
 	    }
-	} else {
-		cp = np;
-	}
+	} else
+	    cp = __DECONST(np);
 	if (*cp && (*cp != ':')) {
 	    err = EINVAL;
 	    goto fail;


>Release-Note:
>Audit-Trail:

From: Garrett Cooper <yaneurabeya@gmail.com>
To: bug-followup@FreeBSD.org, yanegomi@gmail.com
Cc:  
Subject: Re: kern/173932: [patch] Fix compilation errors when -Werror
 specified in sys/boot/Makefile.inc
Date: Mon, 26 Nov 2012 01:36:10 -0800

 I fubared the __DECONST call because I reverted the code I had before
 that worked.
 
 Either way, I'll let the tinderbox run its course and post the
 resulting code that works.
>Unformatted:
