Re: [current tinderbox] failure on amd64/amd64

From: Bruce Evans (bde_at_zeta.org.au)
Date: 05/05/05

  • Next message: J.R. Oldroyd: "Re: async connect problem"
    Date: Fri, 6 May 2005 02:21:18 +1000 (EST)
    To: Bill Paul <wpaul@freebsd.org>
    
    

    On Thu, 5 May 2005, Bill Paul wrote:

    >> On Thu, 5 May 2005, Xin LI wrote:
    >>
    >>> On Thu, May 05, 2005 at 04:44:28AM -0400, FreeBSD Tinderbox wrote:
    >>>> /tinderbox/CURRENT/amd64/amd64/src/sys/modules/ndis/../../compat/ndis/subr_ndis.c: In function `NdisMFreeSharedMemory':
    >>>> /tinderbox/CURRENT/amd64/amd64/src/sys/modules/ndis/../../compat/ndis/subr_ndis.c:1710: warning: long long unsigned int format, uint64_t arg (arg 3)
    >>>
    >>> Maybe we should make use of the PRIx64 macro? (see patch attached)
    >>
    >> No. PRI* is a bug in C99; it should never be used. Just cast the arg to
    >> a suitable larger type with a known format (uintmax_t here). (C99 is
    >> missing support for better ways; either %I as in sfio (?) or %DWIM where
    >> the compiler rewrites the string to match the arg would be better.)
    >
    > I think what you really meant to say was:
    >
    > "Use %jx instead of %qx."
    >
    > Am I right?

    No, the arg must match the format. %jx matches uintmax_t, but the arg has
    type uint64_t. uint64_t just happens to be the same as uintmax_t on all
    supported machines, so using %jx without casting the arg to match gives a
    latent bug.

    Bruce
    _______________________________________________
    freebsd-current@freebsd.org mailing list
    http://lists.freebsd.org/mailman/listinfo/freebsd-current
    To unsubscribe, send any mail to "freebsd-current-unsubscribe@freebsd.org"


  • Next message: J.R. Oldroyd: "Re: async connect problem"

    Relevant Pages

    • Re: Using the HMS functions in a user RPL program.
      ... similarly for an arg of 2.1 failing to add .002 to HMS) ... first, to invoke the internal ascii translator functions, ... on the 48 series you can edit and then remove the string quoting). ... POS {DUP 1 OVER ";" POS SUB ...
      (comp.sys.hp48)
    • Re: symbols in GUI uicontrol
      ... Can I somehow make part of my string one font that will display the ... Create button with more flexible labeling than uicontrol. ... while arg <= length ...
      (comp.soft-sys.matlab)
    • Re: [current tinderbox] failure on amd64/amd64
      ... > the compiler rewrites the string to match the arg would be better.) ...
      (freebsd-current)
    • Re: printf behaviour with illegal or malformed format string
      ... checking by GCC, but we cannot rely on the string being sane in libc, we still need to do error checking. ... All it can do is verify that two arbitrary format strings expect the same arguments and the documentation states it doesn't even manage that: The fmtcheckfunction does not understand all of the conversions that printfdoes. ... then any format that actually consumes the same arg types as the default will consume the ones passed. ... the compiler can't really do ...
      (freebsd-arch)
    • Re: when format strings attack
      ... I saw a warning from homeland security about this. ... the because I am trying to use os.system('command1 arg') and it doesn't ... The "When Format Strings Attack" article isn't relevant to Python. ... Python doesn't arbitrary dump bytes from the stack into a string if you ...
      (comp.lang.python)