Re: [PATCH 01/14] ide-tape: fix potential fs requests bug

From: Borislav Petkov
Date: Sat May 09 2009 - 08:10:24 EST


Hi,

On Sat, May 09, 2009 at 12:25:14PM +0200, Sam Ravnborg wrote:
> OK - but If I am wondering maybe the next reader will
> think the same
> A small comment:
> /* idetape_get_mode_sense_results() prevent sizes less than 1 << 9 */
> Seems to be reasonable.

but you _shouldn't_ be wondering since there's no way for the ide tape
to have smaller blocksize, at least according to the spec - I've yet to
see a device with lesser blocksize.

However, if we still get divide-by-zero then there's something else
that is broken in the driver and a simple comment won't prevent us from
hitting the bug. Instead, the code has to be fixed (and we'll fix it
like the countless other times we've done it sofar).

By the way, ide-floppy does the same calculation because some devices
do have blocksize > 512. And there's no comment there either in
ide_floppy_get_capacity(), the line doing:

floppy->bs_factor = length / 512;

which is basically the same operation (>> 9) for integer types.

And the reason for not having comment there is that 512 is the smallest
blocksize for that type of devices and a comment like that is simply
superfluous because blocksize < 512 is just _not_ _happening_ for the
zillion devices out there.

--
Regards/Gruss,
Boris.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/