public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: David Brownell <david-b@pacbell.net>
To: Linux Kernel list <linux-kernel@vger.kernel.org>
Subject: [patch 2.6.17-rc5-git] fix SCSI compile-time divide-by-zero with HZ < 100
Date: Tue, 30 May 2006 18:51:32 -0700	[thread overview]
Message-ID: <200605301851.32160.david-b@pacbell.net> (raw)

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

                 reply	other threads:[~2006-05-31  1:51 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200605301851.32160.david-b@pacbell.net \
    --to=david-b@pacbell.net \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox