All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andries Brouwer <aebr@win.tue.nl>
To: James Bottomley <James.Bottomley@steeleye.com>
Cc: Christoph Hellwig <hch@lst.de>, linux-scsi@vger.kernel.org
Subject: Re: [PATCH] sanitize ->bios_param prototype
Date: Sat, 26 Oct 2002 00:50:52 +0200	[thread overview]
Message-ID: <20021025225052.GA27927@win.tue.nl> (raw)
In-Reply-To: <200210251718.g9PHIpP03406@localhost.localdomain>

On Fri, Oct 25, 2002 at 12:18:51PM -0500, James Bottomley wrote:

> Loading scsi_mod module
> /lib/scsi_mod.o: unresolved symbol __udivdi3
> 
> The problem seems to be the definition of sector_t for the division.  If I 
> make this fix:
> 
> ===== drivers/scsi/scsicam.c 1.10 vs edited =====
> --- 1.10/drivers/scsi/scsicam.c Thu Oct 24 19:29:22 2002
> +++ edited/drivers/scsi/scsicam.c       Fri Oct 25 12:10:40 2002
> @@ -80,11 +80,11 @@
>         if (ret || ip[0] > 255 || ip[1] > 63) {
>                 ip[0] = 64;
>                 ip[1] = 32;
> -               if ((capacity / (ip[0] * ip[1])) > 65534) {
> +               if (((unsigned long)capacity / (ip[0] * ip[1])) > 65534) {
>                         ip[0] = 255;
>                         ip[1] = 63;
>                 }
> -               ip[2] = capacity / (ip[0] * ip[1]);
> +               ip[2] = (unsigned long)capacity / (ip[0] * ip[1]);
>         }
>  
>         return 0;
> 
> Then everything works fine.  This is obviously not the correct fix, but it's 
> as good as the previous code, so it should be OK.

I didn't see hch's patch, but you can always write

	if (ret || ip[0] > 255 || ip[1] > 63) {
		ip[0] = 64;
		ip[1] = 32;
		if ((capacity >> 11) > 65534) {
			ip[0] = 255;
			ip[1] = 63;
		}
		if (capacity > 65535*63*255)
			ip[2] = 65535;
		else
			ip[2] = (unsigned long)capacity / (ip[0] * ip[1]);
	}

Andries


(ip[2] is returned in a short, so returning larger values is meaningless;
moreover, the current specification says that ip[2] is ignored)

      parent reply	other threads:[~2002-10-25 22:50 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20021025041735.A28857@lst.de>
2002-10-25 17:18 ` [PATCH] sanitize ->bios_param prototype James Bottomley
2002-10-25 17:53   ` Christoph Hellwig
2002-10-25 22:50   ` Andries Brouwer [this message]

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=20021025225052.GA27927@win.tue.nl \
    --to=aebr@win.tue.nl \
    --cc=James.Bottomley@steeleye.com \
    --cc=hch@lst.de \
    --cc=linux-scsi@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.