public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* Typedefs / gcc / HIGHMEM
@ 2001-12-08 18:38 Stephan von Krawczynski
  2001-12-08 23:40 ` H. Peter Anvin
  0 siblings, 1 reply; 8+ messages in thread
From: Stephan von Krawczynski @ 2001-12-08 18:38 UTC (permalink / raw)
  To: linux-kernel

Hello all,                                                            
                                                                      
I recently cam across a warning during compilation of kernel in       
/linux/drivers/net/tulip/interrupt.c. It looks like this:             
                                                                      
interrupt.c: In function `tulip_rx':                                  
interrupt.c:201: warning: unsigned int format, different type arg (arg
4)                                                                    
                                                                      
The source in question looks like this:                               
                                                                      
printk(KERN_ERR "%s: Internal fault: The skbuff addresses "           
"do not match in tulip_rx: %08x vs. %08x  %p / %p.\n",                
dev->name,                                                            
le32_to_cpu(tp->rx_ring[entry].buffer1),                              
tp->rx_buffers[entry].mapping,                                        
skb->head, temp);                                                     
                                                                      
Problem lies in tp->rx_buffers[entry].mapping which is of type        
dma_addr_t.                                                           
dma_addr_t is either defined as u32 (no highmem) or u64 (highmem).    
u32 is unsigned int.                                                  
u64 is unsigned long long                                             
                                                                      
The warning only occurs in the highmem-case. This obviously means that
gcc is not able to evaluate u64 as comparable to unsigned (long). We  
can fix this by casting the value, but on the other hand there seem to
be additional issues possible, the value-comparation one line above   
shows this:                                                           
                                                                      
if (tp->rx_buffers[entry].mapping !=                                  
   le32_to_cpu(tp->rx_ring[entry].buffer1)) {                         
                                                                      
The first is u64, the second u32. Either the u64 value is not         
required, or the statement is broken. Astonishing there is _no_       
compiler warning in this line.                                        
                                                                      
Has anybody looked across the kernel-code to verify if statements like
this are more widespread?                                             
                                                                      
BTW, my personal opinion to "typedef unsigned int u32" is that it     
should rather be "typedef unsigned long u32", but this is religious.  
                                                                      
Regards,                                                              
Stephan                                                               
                                                                      

^ permalink raw reply	[flat|nested] 8+ messages in thread
* Re: Typedefs / gcc / HIGHMEM
@ 2001-12-09  9:31 RaúlNúñez de Arenas Coronado
  0 siblings, 0 replies; 8+ messages in thread
From: RaúlNúñez de Arenas Coronado @ 2001-12-09  9:31 UTC (permalink / raw)
  To: hpa, mirabilos; +Cc: linux-kernel

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 141 bytes --]

    Hi mirabilos :))

>> int64_t.  See the C99 standard.
>Do you have an URI for that standard?

    You must buy it from ISO :(((

    Raúl

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2001-12-09  9:20 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2001-12-08 18:38 Typedefs / gcc / HIGHMEM Stephan von Krawczynski
2001-12-08 23:40 ` H. Peter Anvin
2001-12-09  0:39   ` Stephan von Krawczynski
2001-12-09  0:41     ` H. Peter Anvin
2001-12-09  0:55       ` [MOc]cda*mirabilos
2001-12-09  1:09         ` H. Peter Anvin
2001-12-09  0:48     ` [MOc]cda*mirabilos
  -- strict thread matches above, loose matches on Subject: below --
2001-12-09  9:31 RaúlNúñez de Arenas Coronado

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox