ext2fs crash in -current (r218056)

Peter Jeremy peterjeremy at acm.org
Thu Feb 3 23:33:28 UTC 2011

On 2011-Feb-03 07:13:18 -0800, Jeremy Chadwick <freebsd at jdc.parodius.com> wrote:
>The offset and the length are both explicitly casted and printed as
>signed numbers here.
>For me anyway, the next question is "what are bio_offset and bio_length
>defined as?" (indirectly, "why the explicit cast?").  They're both
>declared as part of struct bio in src/sys/sys/bio.h as shown:
> 71 struct bio {
> 78         off_t   bio_offset;             /* Offset into file. */
> 92         off_t   bio_length;             /* Like bio_bcount */

off_t is always a 64-bit signed int and there's no printf(9) length
modifier to handle this particular situation (it's typically 'long' on
64-bit archs and 'long long' on 32-bit archs).  Instead it's cast to a
signed int which is at least as large that does have a suitable length
modifier (intmax_t can be printed using %jd).

Peter Jeremy
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 196 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-fs/attachments/20110203/745bb949/attachment.pgp

More information about the freebsd-fs mailing list