git: a82f07fc2e24 - main - Fix 32-bit build post 6733401935f83754b4b2744bc3d33ef84b1271e0

Mark Millard marklmi at yahoo.com
Fri Jan 8 23:15:43 UTC 2021


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)



More information about the dev-commits-src-main mailing list