Bug 1336419

Summary: nfsd: Remove some warnings nfsd.c
Product: Red Hat Enterprise Linux 7 Reporter: Steve Dickson <steved>
Component: nfs-utilsAssignee: Steve Dickson <steved>
Status: CLOSED ERRATA QA Contact: Yongcheng Yang <yoyang>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 7.3CC: eguan, fs-qe, xzhou, yoyang
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: nfs-utils-1.3.0-0.27.el7 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-11-04 05:03:55 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Steve Dickson 2016-05-16 12:28:19 UTC
Description of problem:

It would be nice to remove a couple compile warnings with
this upstream commit:

commit a2e431fdd114f2c2466573471dafef9024392f2d
Author: Steve Dickson <steved>
Date:   Wed Apr 30 12:26:06 2014 -0400

    nfsd: Remove some warnings nfsd.c
    
    nfsd.c:347:15: warning: comparison between signed and unsigned integer
    expressions [-Wsign-compare]
    nfsd.c:385:13: warning: comparison between signed and unsigned integer
    expressions [-Wsign-compare]
    
    Signed-off-by: Steve Dickson <steved>

diff --git a/utils/nfsd/nfsd.c b/utils/nfsd/nfsd.c
index 73d6a92..03e3c81 100644
--- a/utils/nfsd/nfsd.c
+++ b/utils/nfsd/nfsd.c
@@ -101,7 +101,7 @@ main(int argc, char **argv)
        int     count = NFSD_NPROC, c, i, error = 0, portnum = 0, fd, found_one;
        char *p, *progname, *port, *rdma_port = NULL;
        char **haddr = NULL;
-       unsigned int hcounter = 0;
+       int hcounter = 0;
        int     socket_up = 0;
        unsigned int minorvers = 0;

Comment 4 Yongcheng Yang 2016-09-01 08:04:57 UTC
Have verified the warning disappeared with latest nfs-utils
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-----------------------------------------------------------
[yoyang@fs-qe nfsd]$ make clean ; make 
rm -rf .libs _libs
 rm -f nfsd
rm -f *.o
rm -f *.lo
gcc -DHAVE_CONFIG_H -I. -I../../support/include  -I/usr/include/tirpc -D_GNU_SOURCE -Wall -Wextra -Wstrict-prototypes  -pipe -g -O2 -MT nfsd.o -MD -MP -MF .deps/nfsd.Tpo -c -o nfsd.o nfsd.c
mv -f .deps/nfsd.Tpo .deps/nfsd.Po
gcc -DHAVE_CONFIG_H -I. -I../../support/include  -I/usr/include/tirpc -D_GNU_SOURCE -Wall -Wextra -Wstrict-prototypes  -pipe -g -O2 -MT nfssvc.o -MD -MP -MF .deps/nfssvc.Tpo -c -o nfssvc.o nfssvc.c
mv -f .deps/nfssvc.Tpo .deps/nfssvc.Po
/bin/sh ../../libtool  --tag=CC   --mode=link gcc -Wall -Wextra -Wstrict-prototypes  -pipe -g -O2   -o nfsd nfsd.o nfssvc.o ../../support/nfs/libnfs.a -ltirpc 
libtool: link: gcc -Wall -Wextra -Wstrict-prototypes -pipe -g -O2 -o nfsd nfsd.o nfssvc.o  ../../support/nfs/libnfs.a -ltirpc
[yoyang@fs-qe nfsd]$ 


And it can be reproduced before the patch merged:
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-------------------------------------------------
[yoyang@fs-qe nfsd]$ make clean ; make
rm -rf .libs _libs
 rm -f nfsd
rm -f *.o
rm -f *.lo
gcc -DHAVE_CONFIG_H -I. -I../../support/include  -I/usr/include/tirpc -D_GNU_SOURCE -Wall -Wextra -Wstrict-prototypes  -pipe -g -O2 -MT nfsd.o -MD -MP -MF .deps/nfsd.Tpo -c -o nfsd.o nfsd.c
nfsd.c: In function ‘main’:
nfsd.c:347:15: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  } while (++i < hcounter); 
               ^
nfsd.c:385:13: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(i=0; i < hcounter; i++)
             ^
mv -f .deps/nfsd.Tpo .deps/nfsd.Po
gcc -DHAVE_CONFIG_H -I. -I../../support/include  -I/usr/include/tirpc -D_GNU_SOURCE -Wall -Wextra -Wstrict-prototypes  -pipe -g -O2 -MT nfssvc.o -MD -MP -MF .deps/nfssvc.Tpo -c -o nfssvc.o nfssvc.c
mv -f .deps/nfssvc.Tpo .deps/nfssvc.Po
/bin/sh ../../libtool  --tag=CC   --mode=link gcc -Wall -Wextra -Wstrict-prototypes  -pipe -g -O2   -o nfsd nfsd.o nfssvc.o ../../support/nfs/libnfs.a -ltirpc 
libtool: link: gcc -Wall -Wextra -Wstrict-prototypes -pipe -g -O2 -o nfsd nfsd.o nfssvc.o  ../../support/nfs/libnfs.a -ltirpc
[yoyang@fs-qe nfsd]$ 


So move on to VERIFIED

Comment 6 errata-xmlrpc 2016-11-04 05:03:55 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://rhn.redhat.com/errata/RHBA-2016-2383.html