[Bugs] [Bug 1187952] New: dht-common.c GF_XATTR_LOCKINFO_KEY compare done wrongly

bugzilla at redhat.com bugzilla at redhat.com
Sat Jan 31 18:20:22 UTC 2015


https://bugzilla.redhat.com/show_bug.cgi?id=1187952

            Bug ID: 1187952
           Summary: dht-common.c GF_XATTR_LOCKINFO_KEY compare done
                    wrongly
           Product: GlusterFS
           Version: mainline
         Component: porting
          Assignee: bugs at gluster.org
          Reporter: dennis at schafroth.com
                CC: bugs at gluster.org, gluster-bugs at redhat.com



Compiling dht-common.c with shows warnings: 
  CC       dht-common.lo
dht-common.c:2997:57: warning: size argument in 'strncmp' call is a comparison
[-Wmemsize-comparison]
                         strlen (GF_XATTR_LOCKINFO_KEY) != 0))) {
                         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~
dht-common.c:2996:17: note: did you mean to compare the result of 'strncmp'
instead?
            && (strncmp (key, GF_XATTR_LOCKINFO_KEY,
                ^
dht-common.c:2997:26: note: explicitly cast the argument to size_t to silence
this warning
                         strlen (GF_XATTR_LOCKINFO_KEY) != 0))) {
                         ^
                         (size_t)(                          )

I believe that the a parentes is misplaced, so the code is doing 

strncmp(key, GF_XATTR_LOCKINFO_KEY, 0) 

instead of 

strncmp(key, GF_XATTR_LOCKINFO_KEY, strlen(GF_XATTR_LOCKINFO_KEY) )

-- 
You are receiving this mail because:
You are on the CC list for the bug.
You are the assignee for the bug.


More information about the Bugs mailing list