Re: [Patch 1/2] cciss: fix for 2TB support

From: Mike Miller (OS Dev)
Date: Thu Feb 22 2007 - 15:18:34 EST


On Wed, Feb 21, 2007 at 07:14:27PM -0800, Andrew Morton wrote:
> >
> > + if (total_size == 0xFFFFFFFF) {
>
> I seem to remember having already questioned this. total_size is sector_t, which
> can be either 32-bit or 64-bit. Are you sure that comparison works as
> intended in both cases?
>
>
> > + if(total_size == 0xFFFFFFFF) {
> > cciss_read_capacity_16(cntl_num, i, 0,
> > &total_size, &block_size);
> > hba[cntl_num]->cciss_read = CCISS_READ_16;
>
> Here too.

Andrew,
Using this test program and changing the type of x to int, long, long long signed and
unsigned the comparison always worked on x86, x86_64, and ia64. It looks to me like
the comparsion will always do what we expect. Unless you see some other problem.


#include <stdio.h>

int main(int argc, char *argv[])
{
unsigned long long x;

x = 0x00000000ffffffff;

printf(sizeof(x) == 8 ?
"x = %lld, sizeof(x) = %d\n" :
"x = %ld, sizeof(x) = %d\n", x, sizeof(x));
if (x == 0xffffffff)
printf("equal\n");
else
printf("not equal\n");

}

-- mikem
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/