linux-scsi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* cciss: warning: right shift count >= width of type
@ 2007-08-12  0:28 Jesper Juhl
  2007-08-12  0:56 ` Jesper Juhl
  2007-08-12  1:21 ` Rene Herman
  0 siblings, 2 replies; 9+ messages in thread
From: Jesper Juhl @ 2007-08-12  0:28 UTC (permalink / raw)
  To: linux-scsi; +Cc: Linux Kernel Mailing List, Jesper Juhl

Hi,

I've been building some randconfig kernels lately and I've noticed 
this in a few builds : 

drivers/block/cciss.c:2614: warning: right shift count >= width of type
drivers/block/cciss.c:2615: warning: right shift count >= width of type
drivers/block/cciss.c:2616: warning: right shift count >= width of type

The code in question is this : 

static void do_cciss_request(struct request_queue *q)
{
...
        sector_t start_blk;
...
                        c->Request.CDB[2]= (start_blk >> 56) & 0xff;    //MSB
                        c->Request.CDB[3]= (start_blk >> 48) & 0xff;
                        c->Request.CDB[4]= (start_blk >> 40) & 0xff;
...
}


The problem stems from these lines in include/linux/types.h : 
...
#ifdef CONFIG_LBD
typedef u64 sector_t;
#else
typedef unsigned long sector_t;
#endif
...

So on a 32bit arch without CONFIG_LBD, sector_t is going to be 32 bits wide.
Thus it seems gcc is absolutely right in complaining about those 
56, 48 & 40 bit shifts, since they are indeed wider than the type 
in the "!CONFIG_LBD on a 32bit arch" case.


I must admit that I have no idear what the proper way to deal with 
that is, so I'll just report it so hopefully someone else can fix it.

By the way; I'm building current Linus git tree, head at commit 
ac07860264bd2b18834d3fa3be47032115524cea


Kind regards,
  Jesper Juhl

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2007-08-12 23:12 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-08-12  0:28 cciss: warning: right shift count >= width of type Jesper Juhl
2007-08-12  0:56 ` Jesper Juhl
2007-08-12  1:25   ` [PATCH] " Rene Herman
2007-08-12  1:54     ` Rene Herman
2007-08-12  1:21 ` Rene Herman
2007-08-12  6:58   ` Al Viro
2007-08-12 19:55     ` Rene Herman
2007-08-12 20:32     ` James Bottomley
2007-08-12 23:08       ` Rene Herman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).