Subject: Signedness/Size consistency ?
To: None <tech-kern@netbsd.org>
From: Arnaud Lacombe <lacombar@gmail.com>
List: tech-kern
Date: 07/13/2007 01:33:35
Hi,

Still about firmload(9), it is normal to have firmware_get_size() returning an
`off_t' argument, which is then passed to firmware_read() casted to `size_t'. 
Then firmware_read() calls vn_rdwr() where `len' is an `int' to be finaly used
to set the `iov_len' and `uio_resid' fields of `struct iovec' which are ... 
`size_t'.

To summarise, we have the following path (on x86):

off_t (int64_t) -> size_t (uint32_t) -> int (int32_t) -> size_t (uint32_t)

Wouldn't it be better to use `size_t' everywhere[1] ? I don't think we will ever
have a +4Gb firmware.

 - Arnaud

[1]: http://www.netbsd.org/~alc/diff/firmload_size_t.diff