kern/173932: [patch] Fix compilation errors when -Werror specified in sys/boot/Makefile.inc

Garrett Cooper yanegomi at gmail.com
Mon Nov 26 08:40:02 UTC 2012


>Number:         173932
>Category:       kern
>Synopsis:       [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:
>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 at 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:
>Unformatted:


More information about the freebsd-bugs mailing list