Dimitry Andric dim at FreeBSD.org wrote on
Fri Jan 8 22:39:16 UTC 2021 :

> . . .
>     The general style in sbin/nvmecontrol apppears to print uint64_t types
>     using %j, so I'm using that instead of the more general (but admittedly
>     ugly) PRIu64.
> . . .
> -                     printf(" FLBA=0x%lx", failing_lba);
> +                     printf(" FLBA=0x%jx", failing_lba);
> . . .

%jx is for uintmax_t values on the stack, which may have more
bits than uint64_t would. It looks to me like a (uintmax_t)
cast is missing to make sure that the format specifier and
value on the stack agree about the memory use.

(FreeBSD seems to have standardized on %jx and %jd and such,
mixed with the matching cast to uintmax_t or intmax_t for
handling the varying sizes across platforms. At least I've
seen a lot of examples of such code in the past.)

===
Mark Millard
marklmi at yahoo.com
( dsl-only.net went
away in early 2018-Mar)

_______________________________________________
[email protected] mailing list
https://lists.freebsd.org/mailman/listinfo/dev-commits-src-main
To unsubscribe, send any mail to "[email protected]"

Reply via email to