Usage of MTD_UADDR_UNNECESSARY broken?

Thayne Harbaugh tharbaugh at lnxi.com
Mon Nov 8 14:50:53 EST 2004


On Mon, 2004-11-08 at 13:55 +0100, Alexander Hoffmann wrote:
> Ben Dooks wrote:
> 
> >On Mon, Nov 08, 2004 at 12:54:16PM +0100, Alexander Hoffmann wrote:
> >  
> >
> >>Hi everyone,
> >>
> >>can anybody please explain me the exact difference between 
> >>MTD_UADDR_DONT_CARE and MTD_UADDR_UNNECESSARY .
> >>Because if I use MTD_UADDR_UNNECESSARY an not existing field in the 
> >>unlock_addrs array is beeing referenced
> >>(/drivers/mtd/chips/jedec_probe.c, function cfi_jedec_setup, line 1740):
> >>
> >>/* Mask out address bits which are smaller than the device type */
> >>mask = ~(p_cfi->device_type-1);
> >>p_cfi->addr_unlock1 = unlock_addrs[uaddr].addr1 & mask;
> >>p_cfi->addr_unlock2 = unlock_addrs[uaddr].addr2 & mask;
> >>    
> >>
> >
> >hmm, thought this masking had been eliminated in later copies of
> >the mtd code?

Yes, the masking has been eliminated, but someone left the comment in
(doh!).

> Ok, you are right. But this doesn't change the fact that
> 
> unlock_addrs[uaddr].addr1
> 
> refers to an nonexisting field in the unlock_addrs array.

I don't see how the code you that you described is being reached.  It
looks like the start of jedec_probe_chip() checks for UNNECESSARY and
returns 0 (although I would expect 1) and so cfi_jedec_setup() should
never be called with UNNECESSARY (even for subsequent chips).

Can you tell me what your chip is and why you think that cfi_jedec_setup
() is called?

-- 
Thayne Harbaugh
Linux Networx
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : http://lists.infradead.org/pipermail/linux-mtd/attachments/20041108/9cc5f589/attachment.bin 


More information about the linux-mtd mailing list