public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
From: James Bottomley <James.Bottomley@HansenPartnership.com>
To: Grant Grundler <grundler@google.com>
Cc: akpm@linux-foundation.org, linux-scsi@vger.kernel.org,
	fujita.tomonori@lab.ntt.co.jp,
	Alan Cox <alan@lxorguk.ukuu.org.uk>
Subject: Re: [patch 13/17] drivers/scsi/initio.c: suppress compile warning
Date: Fri, 28 Mar 2008 17:26:21 -0500	[thread overview]
Message-ID: <1206743181.3662.55.camel@localhost.localdomain> (raw)
In-Reply-To: <da824cf30803281455g22334554y8cb3887beec951a@mail.gmail.com>

On Fri, 2008-03-28 at 14:55 -0700, Grant Grundler wrote:
> On Fri, Mar 28, 2008 at 2:48 PM,  <akpm@linux-foundation.org> wrote:
> > From: Andrew Morton <akpm@linux-foundation.org>
> >
> >  powerpc:
> >
> >  drivers/scsi/initio.c: In function 'initio_build_scb':
> >  drivers/scsi/initio.c:2585: warning: large integer implicitly truncated to unsigned type
> 
> I posted a fix for this yesterday and Alan Cox ACKed it.
> 
> It's here:
>     http://marc.info/?l=linux-scsi&m=120668352622659&w=2

Actually, I have to say that neither of these looks to be correct.
Andrew's is obviously wrong because (u8)cpu_to_le32(xxx) always returns
zero on a BE platform if xxx is an 8 bit quantity.

However, the driver clearly does a cblk->bufflen (a __le32 quantity) =
cblk->senselen, which looks obviously wrong on a BE platform as well.
Plus there's another hunk around here:

		scsi_for_each_sg(cmnd, sglist, cblk->sglen, i) {
			sg->data = cpu_to_le32((u32)sg_dma_address(sglist));
			total_len += sg->len = cpu_to_le32((u32)sg_dma_len(sglist));
			++sg;
		}

here total_len is a le32 quantity

		cblk->buflen = (scsi_bufflen(cmnd) > total_len) ?

here we compare against a CPU native quantity

			total_len : scsi_bufflen(cmnd);

And here we set either to a le32 or cpu native quantity depending on the
result of the comparison.


Alan, has this driver ever worked on a BE platform?

James



  parent reply	other threads:[~2008-03-28 22:26 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-03-28 21:48 [patch 13/17] drivers/scsi/initio.c: suppress compile warning akpm
2008-03-28 21:55 ` Grant Grundler
2008-03-28 22:13   ` Andrew Morton
2008-03-28 22:26   ` James Bottomley [this message]
2008-03-28 22:43     ` Alan Cox
2008-03-28 23:51       ` James Bottomley
2008-03-29  0:49         ` Grant Grundler
2008-03-29  3:09           ` James Bottomley
2008-03-31  4:50             ` Grant Grundler
2008-03-31 14:56               ` James Bottomley
2008-03-31 16:23                 ` Grant Grundler
2008-04-04  7:05             ` Grant Grundler
2008-04-05 16:14               ` Grant Grundler

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=1206743181.3662.55.camel@localhost.localdomain \
    --to=james.bottomley@hansenpartnership.com \
    --cc=akpm@linux-foundation.org \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=fujita.tomonori@lab.ntt.co.jp \
    --cc=grundler@google.com \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox