lkml.org 
[lkml]   [2003]   [Jan]   [29]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] IDE: Do not call bh_phys() on buffers with invalid b_page.
On Wed, Jan 29 2003, Benjamin Herrenschmidt wrote:
> On Wed, 2003-01-29 at 16:22, Jens Axboe wrote:
>
> > Ehm no, if b_data is < PAGE_SIZE, it's probably an offset and not a
> > valid address. So it should be exactly where it is -- for b_page, it's
> > _not_ buggy for b_data to be < PAGE_SIZE. That's expected. Submitter
> > would have to be buggy for it to trigger, though, so you can just remove
> > it if you want.
>
> Ah, I see what you wanted to check now :) Ok, I won't remove it, though
> it would still make sense to extend the test to PAGE_OFFSET I beleive,
> any b_data < PAGE_OFFSET is wrong.

No, any b_data < PAGE_OFFSET is not wrong, that's the point. For highmem
b_page, b_data will be the offset into the page. So it could be 2048,
for instance.

The test is meant to catch an invalid buffer_head, where b_page is not
set but b_data isn't valid either. So to make it complete, you could do:

if (bh->b_page) {
...
if (bh->b_data >= PAGE_SIZE)
BUG();
} else {
...
if (bh->b_data < PAGE_SIZE)
BUG();
if (bh->b_data < PAGE_OFFSET)
BUG();
}

as they are two different bugs.

> Anyway, let's leave 2.4 as it is now.

:-)

--
Jens Axboe

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

\
 
 \ /
  Last update: 2005-03-22 13:32    [W:0.045 / U:3.428 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site