Module Name:    src
Committed By:   christos
Date:           Tue Apr  2 22:25:10 UTC 2019

Modified Files:
        src/sys/lib/libsa: Makefile bootparam.c ufs.c

Log Message:
fix sign-compare and sign-passing errors.


To generate a diff of this commit:
cvs rdiff -u -r1.89 -r1.90 src/sys/lib/libsa/Makefile
cvs rdiff -u -r1.20 -r1.21 src/sys/lib/libsa/bootparam.c
cvs rdiff -u -r1.75 -r1.76 src/sys/lib/libsa/ufs.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/lib/libsa/Makefile
diff -u src/sys/lib/libsa/Makefile:1.89 src/sys/lib/libsa/Makefile:1.90
--- src/sys/lib/libsa/Makefile:1.89	Sun Mar 31 16:08:45 2019
+++ src/sys/lib/libsa/Makefile	Tue Apr  2 18:25:10 2019
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.89 2019/03/31 20:08:45 christos Exp $
+#	$NetBSD: Makefile,v 1.90 2019/04/02 22:25:10 christos Exp $
 
 LIB=	sa
 LIBISPRIVATE?= yes
@@ -15,9 +15,11 @@ CPPFLAGS=	-I${SADIR} ${SACPPFLAGS} ${SAM
 #COPTS+= -ansi -pedantic -Wall
 
 # For testing
-# WARNS=5
-# COPTS+=-ffreestanding
-# CPPFLAGS+= -I${.CURDIR}/../../ -I${.CURDIR}
+#WARNS=6
+#NOSSP=yes
+#NOFORTIFY=yes
+#COPTS+=-ffreestanding -Wpointer-sign
+#CPPFLAGS+= -I${.CURDIR}/../../ -I${.CURDIR}
 
 .if defined(SA_EXTRADIR)
 .-include "${SA_EXTRADIR}/Makefile.inc"

Index: src/sys/lib/libsa/bootparam.c
diff -u src/sys/lib/libsa/bootparam.c:1.20 src/sys/lib/libsa/bootparam.c:1.21
--- src/sys/lib/libsa/bootparam.c:1.20	Sun Mar 31 16:08:45 2019
+++ src/sys/lib/libsa/bootparam.c	Tue Apr  2 18:25:10 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: bootparam.c,v 1.20 2019/03/31 20:08:45 christos Exp $	*/
+/*	$NetBSD: bootparam.c,v 1.21 2019/04/02 22:25:10 christos Exp $	*/
 
 /*
  * Copyright (c) 1995 Gordon W. Ross
@@ -61,7 +61,7 @@ n_short		bp_server_port;	/* net order */
 
 uint32_t	hostnamelen;
 char		domainname[FNAME_SIZE]; /* our DNS domain */
-int		domainnamelen;
+uint32_t	domainnamelen;
 
 /*
  * RPC definitions for bootparamd
@@ -247,7 +247,7 @@ bp_getfile(int sockfd, char *key, struct
 	char *send_tail, *recv_head;
 	/* misc... */
 	struct iodesc *d;
-	int sn_len, path_len;
+	uint32_t sn_len, path_len;
 	ssize_t rlen;
 
 	if (!(d = socktodesc(sockfd))) {
@@ -296,7 +296,7 @@ bp_getfile(int sockfd, char *key, struct
 	 */
 
 	/* server name */
-	sn_len = FNAME_SIZE-1;
+	sn_len = FNAME_SIZE - 1;
 	if (xdr_string_decode(&recv_head, serv_name, &sn_len)) {
 		RPC_PRINTF(("%s: bad server name\n", __func__));
 		return -1;
@@ -391,7 +391,7 @@ xdr_inaddr_encode(char **pkt, struct in_
 	xi->atype = htonl(1);
 	uia.l = ia.s_addr;
 	cp = uia.c;
-	ip = xi->addr;
+	ip = (uint32_t *)xi->addr;
 	/*
 	 * Note: the htonl() calls below DO NOT
 	 * imply that uia.l is in host order.
@@ -427,7 +427,7 @@ xdr_inaddr_decode(char **pkt, struct in_
 	}
 
 	cp = uia.c;
-	ip = xi->addr;
+	ip = (uint32_t *)xi->addr;
 	/*
 	 * Note: the ntohl() calls below DO NOT
 	 * imply that uia.l is in host order.

Index: src/sys/lib/libsa/ufs.c
diff -u src/sys/lib/libsa/ufs.c:1.75 src/sys/lib/libsa/ufs.c:1.76
--- src/sys/lib/libsa/ufs.c:1.75	Sun Mar 31 16:08:45 2019
+++ src/sys/lib/libsa/ufs.c	Tue Apr  2 18:25:10 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: ufs.c,v 1.75 2019/03/31 20:08:45 christos Exp $	*/
+/*	$NetBSD: ufs.c,v 1.76 2019/04/02 22:25:10 christos Exp $	*/
 
 /*-
  * Copyright (c) 1993
@@ -422,7 +422,7 @@ buf_read_file(struct open_file *f, char 
 	off = ufs_blkoff(fs, fp->f_seekp);
 	file_block = ufs_lblkno(fs, fp->f_seekp);
 #ifdef LIBSA_LFS
-	block_size = (size_t)dblksize(fs, &fp->f_di, file_block);
+	block_size = (size_t)dblksize(fs, &fp->f_di, (uint64_t)file_block);
 #else
 	block_size = (size_t)ffs_sblksize(fs, (int64_t)fp->f_di.di_size, file_block);
 #endif

Reply via email to