[patch 2.6.17-rc5-git] fix SCSI compile-time divide-by-zero with HZ < 100

From: David Brownell
Date: Tue May 30 2006 - 21:51:45 EST


This is the quickie patch, but someone might care to make
the USER_HZ-coupled value scale for HZ=64 etc.
This fixes a compiler-reported divide-by-zero when HZ < 100.

Signed-off-by: David Brownell <dbrownell@xxxxxxxxxxxxxxxxxxxxx>

--- 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)