Checks to see if unsigned integers < 0

Herwin Weststrate herwin at
Fri Jul 12 12:36:13 MDT 2013

(Issues were found compiling with clang, so it's a kind of static code 

A number of times some checks are run to see if an unsigned integer is 
smaller than zero. Of course this cannot be true, this patch removes 
these checks.

Small remarks:

- in source3/libnet/libnet_dssync_keytab.c the behaviour is changed, 
because the LHS of the and-statement was always false. To revert to the 
original behaviour the complete if-statement (with body) should be removed
- the original implementation of 
source4/dsdb/samdb/ldb_modules/partition.c would cause an endless loop. 
The current code is just to be as close as possible to the original. A 
cleaner solution would be

   while (i > 0) {

There are tons of more warnings found by compiling with clang. 
Unfortunately something gives an error during the linking phase. It 
might be worth to have a quick look at the other errors, most of them 
are probably easier to unserstand if you have some better knowledge of 
the Samba internals

Herwin Weststrate
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Removed-checks-for-unsigned-int-0.patch
Type: text/x-patch
Size: 5652 bytes
Desc: not available
URL: <>

More information about the samba-technical mailing list