tech-kern archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: Dealing with strange disk devices
On Mon, Oct 28, 2019 at 07:24:03PM +0100, Martin Husemann wrote:
> The practical difference is likely zero, as such setup just do not happen
> in real life (and the other error(s) needed to get here being fixed).
> I prefer my version because it does not introduce artifical limits on the
> sector size - but it is not a very strong technical argument.
This artifical limit already exists, our whole disk subsystem works with
blocks and these are measured in DEV_BSIZE units.
Using blocks instead of bytes used be the natural thing (disks use
blocks and there used to be only a single technology with a single
system wide block size). But even now it helps because it avoids
dealing with integer overflows and alignment restrictions in many
places.
So anything smaller as DEV_BSIZE will already fail at some other place,
validating it in bounds_check_with_label might even be the best place
for now, independent on wether it triggers a division by zero. Better
places could exist when all drivers would use common code, there are
still exceptions. Then you could validate the value once, and not
for every disk access.
Greetings,
--
Michael van Elst
Internet: mlelstv%serpens.de@localhost
"A potential Snark may lurk in every tree."
Home |
Main Index |
Thread Index |
Old Index