ide-floppy: Fix unformatted media crash
authorAlan Cox <alan@redhat.com>
Wed, 4 Apr 2007 19:34:22 +0000 (21:34 +0200)
committerAdrian Bunk <bunk@stusta.de>
Wed, 4 Apr 2007 19:34:22 +0000 (21:34 +0200)
commitfeb26509abe0672e6b56fa4c4765c0e62d4432c3
treec44d3b467fc988a9c6ce87bc4517a071ec73058e
parent5f4a9d1b7a413d6aac382c51692ac0df785068c5
ide-floppy: Fix unformatted media crash

A ZIP or similar with unformatted media will cause crashes when attempts
are made to read/write it in some cases. This is because bs_factor is
zero and we divide by it causing an oops.

As the size of a non-accessible/non-existant media is really a bit of a
zen question it doesn't matter if non-existant media is 512 bytes per
sector or zero. Setting it to 1 causes us to generate 512 bytes/sector
accesses and error properly.

Based on a fix found lurking in an ancient bugzilla entry since about 2004 (ugghhh)

Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Adrian Bunk <bunk@stusta.de>
drivers/ide/ide-floppy.c