linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [patch 2.6.17-rc5-git] fix SCSI compile-time divide-by-zero with HZ < 100
@ 2006-05-31  1:51 David Brownell
  0 siblings, 0 replies; only message in thread
From: David Brownell @ 2006-05-31  1:51 UTC (permalink / raw)
  To: Linux Kernel list

[-- Attachment #1: Type: text/plain, Size: 105 bytes --]

This is the quickie patch, but someone might care to make
the USER_HZ-coupled value scale for HZ=64 etc.

[-- Attachment #2: scsi.patch --]
[-- Type: text/x-diff, Size: 444 bytes --]

This fixes a compiler-reported divide-by-zero when HZ < 100.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>

--- a/block/scsi_ioctl.c
+++ b/block/scsi_ioctl.c
@@ -63,7 +63,7 @@ static int scsi_get_bus(request_queue_t 
 
 static int sg_get_timeout(request_queue_t *q)
 {
-	return q->sg_timeout / (HZ / USER_HZ);
+	return q->sg_timeout / max(1,(HZ / USER_HZ));
 }
 
 static int sg_set_timeout(request_queue_t *q, int __user *p)

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2006-05-31  1:51 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-05-31  1:51 [patch 2.6.17-rc5-git] fix SCSI compile-time divide-by-zero with HZ < 100 David Brownell

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).