[Bug 206804] Inconsistent type handling for sizes in sbuf code

bugzilla-noreply at freebsd.org bugzilla-noreply at freebsd.org
Sun Jan 31 20:49:45 UTC 2016


https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=206804

--- Comment #4 from CTurt <cturt at hardenedbsd.org> ---
The error is:

/jenkins/workspace/HardenedBSD-CURRENT-unstable-amd64/sy/kern/subr_sbuf.c:226:60:
error: format specifies type 'int' but the argument has type 'ssize_t' (aka
'long') [-Werror,-Wformat] ("attempt to create an sbuf of negative length
(%d)", length));

Referring to this line:

KASSERT(length >= 0,
            ("attempt to create an sbuf of negative length (%d)", length));

I find it odd that this would give an error, but the below line doesn't:

        KASSERT(s->s_len < s->s_size,
            ("wrote past end of sbuf (%d >= %d)", s->s_len, s->s_size));

Regardless, I've committed a new patch to use the `%zd` format specifier here,
instead:

https://github.com/HardenedBSD/hardenedBSD-playground/commit/5165b5cc55f09ba357bc1ee41d828ec2864e7d0d.patch

-- 
You are receiving this mail because:
You are the assignee for the bug.


More information about the freebsd-bugs mailing list