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

From: Al Viro
Date: Fri Feb 13 2009 - 14:35:22 EST


On Fri, Feb 13, 2009 at 11:13:50AM -0800, Joe Eykholt wrote:

> > 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 real problem, of course, is that we should _not_ be doing 64bit-division
here, be it by shifts or by __udiv...; if anything, we ought to store the
bus version of HOSTDATA(...)->ccb at the time we'd checked that allocation
got us a small enough address (i.e. after scsi_register()). And store it
in u32.
--
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/