Commit 8e33c50d authored by Randy Dunlap's avatar Randy Dunlap Committed by Linus Torvalds

[PATCH] ftape divide-by-zero found by Stanford Checker

This fixes a potential divide-by-zero found by the Stanford Checker.
parent 2b009dcf
......@@ -589,6 +589,8 @@ TRACE(ft_t_info, "the famous ??? bug: max_floppy_track off by one !");
(max_floppy_track != 254 || max_floppy_sector != 128))
#endif
) {
char segperheadz = ftape_segments_per_head ? ' ' : '?';
char segpercylz = ftape_segments_per_cylinder ? ' ' : '?';
TRACE(ft_t_err,"Tape parameters inconsistency, please report");
TRACE(ft_t_err, "reported = %d/%d/%d/%d/%d/%d",
ft_format_code,
......@@ -597,14 +599,20 @@ TRACE(ft_t_info, "the famous ??? bug: max_floppy_track off by one !");
max_floppy_side,
max_floppy_track,
max_floppy_sector);
TRACE(ft_t_err, "required = %d/%d/%d/%d/%d/%d",
TRACE(ft_t_err, "required = %d/%d/%d/%d%c/%d%c/%d",
ft_format_code,
ft_segments_per_track,
ft_tracks_per_tape,
ftape_segments_per_head ?
((ft_segments_per_track * ft_tracks_per_tape -1) /
ftape_segments_per_head ),
ftape_segments_per_head ) :
(ft_segments_per_track * ft_tracks_per_tape -1),
segperheadz,
ftape_segments_per_cylinder ?
(ftape_segments_per_head /
ftape_segments_per_cylinder - 1 ),
ftape_segments_per_cylinder - 1 ) :
ftape_segments_per_head - 1,
segpercylz,
(ftape_segments_per_cylinder * FT_SECTORS_PER_SEGMENT));
TRACE_EXIT -EIO;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment