RE: [PATCH] modify the type of element of MessageUnit_B in arcmsr

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



James,
You are such a great teacher. 
I learned it.
So what about my last submitted patch?
Would it be turned down or go on?

-----Original Message-----
From: James Bottomley [mailto:James.Bottomley@xxxxxxxxxxxxxxxxxxxxx] 
Sent: Wednesday, March 05, 2008 11:30 PM
To: nick.cheng@xxxxxxxxxxxx
Cc: 'Andrew Morton'; linux-scsi@xxxxxxxxxxxxxxx; randy.dunlap@xxxxxxxxxx;
'Tomas Henzl'; viro@xxxxxxxxxxxxxxxx
Subject: RE: [PATCH] modify the type of element of MessageUnit_B in arcmsr

On Wed, 2008-03-05 at 15:38 +0800, nickcheng wrote:
> James,
> Thanks for your care.
> I agree with your point of labeling the registers with their correct
width.
> But I did see an error.
> I have a script to load/unload driver modules for Type B Adapter
repeatedly.
> While unloading the former driver modules, it pops up the message,
> iounmap: bad address ffffc2000021f000
> Call Trace:
>  [<ffffffff881ec2a2>] :arcmsr:arcmsr_free_ccb_pool+0x54/0x8f

Aha, that's because of this, isn't it:

                iounmap(reg->drv2iop_doorbell_reg -
ARCMSR_DRV2IOP_DOORBELL);
                iounmap(reg->ioctl_wbuffer_reg - ARCMSR_IOCTL_WBUFFER);

You're doing pointer subtraction on a uint32_t *, so it's subtracting in
units of four bytes.  In many ways, converting the two pointers to void
* isn't much better, because gcc can sometimes complain it doesn't know
the width of a void * for pointer subtraction ... but mostly it just
treats it as byte width.  What you actually want, to get the error to go
away is:

                iounmap((u8 *)reg->drv2iop_doorbell_reg -
ARCMSR_DRV2IOP_DOORBELL);
                iounmap((u8 *)reg->ioctl_wbuffer_reg -
ARCMSR_IOCTL_WBUFFER);

Which should ensure the pointer arithmetic is done correctly.  Of
course, the ideal would be to get rid of the pointer subtraction ... it
always ends up causing subtle and hard to find problems.

James


--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]
  Powered by Linux