Re: next Feb 13 drivers/scsi/aha1542.ko build break

From: Joe Eykholt
Date: Fri Feb 13 2009 - 14:14:20 EST


Randy Dunlap wrote:
> Sachin P. Sant wrote:
>> Feb 13 next x86 allmodconfig build breaks with
>>
>> ERROR: "__udivdi3" [drivers/scsi/aha1542.ko] undefined!
>>
>> .config attached.
>
>
> I'm seeing that also. I think that it's this line in aha1542.c:
>
> 495: mbo = (scsi2int(mb[mbi].ccbptr) - (SCSI_BUF_PA(&ccb[0]))) / sizeof(struct ccb);
>
> since I can comment out the "/ sizeof(struct ccb)" and the driver builds successfully.
>
> This may need a patch to use one of the div() macros (?).

In the above case, this problem might not occur if sizeof(struct ccb) happened to
be a power of 2, since the compiler generates a shift in that case.
Then later someone could increase the size of the struct and introduce this problem.

The kernel infrastructure should fix that without requiring the driver to change.
Drivers ought to be allowed to divide.

I've also seen this in another driver that divided a u64 by a constant.
I noticed that linux/math64.h provides div_u64(), but it seems awkward to call
that when the compiler generates a call to __udivdi3 (apparently).

Can't we just provide __udivdi3, since gcc generates that call?
Otherwise, problems like this will continue to crop up.

Joe


--
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/