Re: [PATCH] IDE: Do not call bh_phys() on buffers with invalid b_page.

From: Benjamin Herrenschmidt (benh@kernel.crashing.org)
Date: Wed Jan 29 2003 - 10:20:15 EST


On Wed, 2003-01-29 at 16:00, Jens Axboe wrote:
> On Wed, Jan 29 2003, Benjamin Herrenschmidt wrote:
> > Hi, I just spotted this in the patch (but the code itself have been
> > there since 2.4.20-pre2).
> >
> > > - if (((unsigned long) bh->b_data) < PAGE_SIZE)
> > > + if ((unsigned long) bh->b_data < PAGE_SIZE)
> >
> > Didn't you meant PAGE_OFFSET and not PAGE_SIZE here ? I fail to see why
> > it would make any sense to compare a virtual address to PAGE_SIZE ;)
>
> For highmem buffer heads, b_data is the offset into the page. Does look
> confusing, I'll give you that :-)
>
> The test should most likely just be removed, if anything.

I would agree with you if you were actually testing that ;) Look
closely, the test is in the non-b_page case, that is when b_data
contains a kernel virtual address.

So the test should be either removed or moved to the first part of the
if () statement.

In our case (virtual address, not page), though, it makes some sense to
test that it's higher or equal than PAGE_OFFSET since virt_to_page()
won't work on addresses not part of the lowmem linear mapping.

Ben.

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



This archive was generated by hypermail 2b29 : Fri Jan 31 2003 - 22:00:22 EST