Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/lib/libsa fix sign-compare and sign-passing errors.



details:   https://anonhg.NetBSD.org/src/rev/98464203ce2c
branches:  trunk
changeset: 997941:98464203ce2c
user:      christos <christos%NetBSD.org@localhost>
date:      Tue Apr 02 22:25:10 2019 +0000

description:
fix sign-compare and sign-passing errors.

diffstat:

 sys/lib/libsa/Makefile    |  10 ++++++----
 sys/lib/libsa/bootparam.c |  12 ++++++------
 sys/lib/libsa/ufs.c       |   4 ++--
 3 files changed, 14 insertions(+), 12 deletions(-)

diffs (96 lines):

diff -r 535126c29690 -r 98464203ce2c sys/lib/libsa/Makefile
--- a/sys/lib/libsa/Makefile    Tue Apr 02 21:29:46 2019 +0000
+++ b/sys/lib/libsa/Makefile    Tue Apr 02 22:25:10 2019 +0000
@@ -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 @@
 #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"
diff -r 535126c29690 -r 98464203ce2c sys/lib/libsa/bootparam.c
--- a/sys/lib/libsa/bootparam.c Tue Apr 02 21:29:46 2019 +0000
+++ b/sys/lib/libsa/bootparam.c Tue Apr 02 22:25:10 2019 +0000
@@ -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 @@
 
 uint32_t       hostnamelen;
 char           domainname[FNAME_SIZE]; /* our DNS domain */
-int            domainnamelen;
+uint32_t       domainnamelen;
 
 /*
  * RPC definitions for bootparamd
@@ -247,7 +247,7 @@
        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 @@
         */
 
        /* 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 @@
        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 @@
        }
 
        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.
diff -r 535126c29690 -r 98464203ce2c sys/lib/libsa/ufs.c
--- a/sys/lib/libsa/ufs.c       Tue Apr 02 21:29:46 2019 +0000
+++ b/sys/lib/libsa/ufs.c       Tue Apr 02 22:25:10 2019 +0000
@@ -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 @@
        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



Home | Main Index | Thread Index | Old Index