]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
newbus: use ssize_t to match sb's len and size, fix ordering of space check
authorWarner Losh <imp@FreeBSD.org>
Mon, 12 Oct 2020 22:07:44 +0000 (22:07 +0000)
committerWarner Losh <imp@FreeBSD.org>
Mon, 12 Oct 2020 22:07:44 +0000 (22:07 +0000)
commite59db4685414e3fa23ac5c996d05708b678053ac
treef0fbe3c934c9ed97f49bc6b42d4f216570a723fd
parentf91b0c1c18cceb249ad21f8b375f8f91c94c4620
newbus: use ssize_t to match sb's len and size, fix ordering of space check

Both s_len and s_size are ssize_t, so their differece is also more
properly a ssize_t not a size_t. Also, assert that len is <= size when
we enter. This should always be the case. Ensure that we have that one
byte that we write to the end of the buffer before we do so, though
the error should already be set on the buffer if not, and the only
times we supply 'partial' buffers they should be plenty large.

Reviewed by: cem, jhb (prior version, I did cem's suggestion)
Differential Revsion: https://reviews.freebsd.org/D26752
sys/kern/subr_bus.c