Bit Truncation in drivers/pci/probe.c on amd64

From: Gabriel A. Devenyi (ace_at_staticwave.ca)
Date: 09/06/05

  • Next message: Antonino A. Daplas: "Re: who sets boot_params[].screen_info.orig_video_isVGA?"
    To: linux-kernel@vger.kernel.org
    Date:	Mon, 5 Sep 2005 21:15:27 -0400
    
    

    In the current git repository, on my amd64 machine I get the following warning on compile
    drivers/pci/probe.c: In function `pci_read_bases':
    drivers/pci/probe.c:166: warning: large integer implicitly truncated to unsigned type
    drivers/pci/probe.c:216: warning: large integer implicitly truncated to unsigned type

    I've tracked this down to pci_size, and two #define's in include/linux/pci.h

    #define PCI_BASE_ADDRESS_MEM_MASK (~0x0fUL)
    #define PCI_ROM_ADDRESS_MASK (~0x7ffUL)

    pci_size expects 3 u32 arguments,but from what I can tell, on 64 bit arch's the two above
    defines expand to 64bit values, and are truncated when being passed.

    I'm not sure how to go about fixing this, if pci_size should accept a u64 or if the defines should
    be changed. Is this bug dangerous? What should be done to fix it?

    -- 
    Gabriel A. Devenyi
    ace@staticwave.ca
    -
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at  http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at  http://www.tux.org/lkml/
    

  • Next message: Antonino A. Daplas: "Re: who sets boot_params[].screen_info.orig_video_isVGA?"

    Relevant Pages

    • Re: Possible dcache BUG
      ... During the compile, the above line output this warning: ... Copyright 2004 by Maurice Eugene Heskett, ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)
    • Bit Truncation in drivers/pci/probe.c on amd64
      ... on my amd64 machine I get the following warning on compile ... drivers/pci/probe.c:166: warning: large integer implicitly truncated to unsigned type ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)
    • [2.6 patch] fix aztcd.c compile warning
      ... with belows patch drivers/cdrom/aztcd.c compiles without warning ... the warning shows off on each single compile statistics by cherry. ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)
    • cant compile udf
      ... fs/udf/super.c:327: `opt' undeclared ... fs/udf/super.c:311: warning: unused variable `option' ... I tried to compile it as a module and inside the kernel too. ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)
    • Re: GCC 3.3.1, new warnings with <limits>
      ... > on an unsigned type which does a < compareison. ... and thus prints out the warning. ... If I take the following preprocessed source and compile it ...
      (freebsd-current)