NetBSD-Bugs archive

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

Re: kern/46864: compile warnings in 5_1_STABLE in sys/dev/pci_subr.c



The following reply was made to PR kern/46864; it has been noted by GNATS.

From: David Laight <david%l8s.co.uk@localhost>
To: gnats-bugs%NetBSD.org@localhost
Cc: 
Subject: Re: kern/46864: compile warnings in 5_1_STABLE in sys/dev/pci_subr.c
Date: Mon, 27 Aug 2012 10:39:33 +0100

 On Mon, Aug 27, 2012 at 08:00:01AM +0000, 
Wolfgang.Stukenbrock%nagler-company.com@localhost wrote:
 > >Number:         46864
 > >Category:       kern
 > >Synopsis:       compile warnings in 5_1_STABLE in sys/dev/pci_subr.c
 ...
 >      The fist block is a warning for calls like "snprintf(cp, ep - cp, ...), 
 > where cp and ep are of type "char *".
 >      The compiler generates a signed value from that, but snprintf param 2 
 > is unsigned.
 
 More because likely 'ep - cp' is 64bit.
 
 >      The second block seems to be a "gcc feature" ...
 >      "(caps >> 6) & 7" and simular expressions produce the warning where 
 > "caps" is of type "uint16_t".
 
 No, C requires uint16_t be promoted to signed int before any arithmetic.
 Although shifts of +ve numbers are fine - and lint could know this.
 
 >      The last one passes a variable 'off' of type "int" where the functions 
 > expects an "unsigned int".
 
 > >Fix:
 Don't run lint :-)
 
 
        David
 
 -- 
 David Laight: david%l8s.co.uk@localhost
 


Home | Main Index | Thread Index | Old Index