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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 <[email protected]>

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

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux