[Btrfs-devel] extent_io.c: bio_add_page() error check for bio ptr

Peter Teoh htmldeveloper at gmail.com
Sun Mar 16 09:46:06 PDT 2008


oh yes, u are right, it should be BUG_ON(bio).

On Mon, Mar 17, 2008 at 12:22 AM, Miguel Figueiredo Mascarenhas Sousa
Filipe <miguel.filipe at gmail.com> wrote:
> Hi,
>
>
>  On Sun, Mar 16, 2008 at 4:36 AM, Peter Teoh <htmldeveloper at gmail.com> wrote:
>  > bio_add_page() requires non-NULL bio ptr for dereferencing.
>  >
>  >  Signed-off-by: Peter Teoh <htmldeveloper at gmail.com>
>  >
>  >  --- extent_io.c.orig1   2008-03-16 12:43:59.000000000 +0800
>  >  +++ extent_io.c 2008-03-16 12:45:03.000000000 +0800
>  >  @@ -1729,6 +1729,7 @@ static int submit_extent_page(int rw, st
>  >
>  >         if (bio_ret && *bio_ret) {
>  >                 bio = *bio_ret;
>  >  +               BUG_ON(!bio);
>  I might be confused, but if you entered that if.. then bio != NULL
>  So, this BUG_ON is wrong...
>
>  Or am I missing something ?
>
>
>  >                 if (bio->bi_sector + (bio->bi_size >> 9) != sector ||
>  >                     bio_add_page(bio, page, size, offset) < size) {
>  >                         ret = submit_one_bio(rw, bio);
>  >  @@ -1741,6 +1742,7 @@ static int submit_extent_page(int rw, st
>  >         bio = extent_bio_alloc(bdev, sector, nr, GFP_NOFS | __GFP_HIGH);
>  >         if (!bio) {
>  >                 printk("failed to allocate bio nr %d\n", nr);
>  >  +               BUG_ON(!bio);
>  >         }
>  >
>  >
>  >
>  >
>  >  --
>  >  Regards,
>  >  Peter Teoh
>  >
>  >  _______________________________________________
>  >  Btrfs-devel mailing list
>  >  Btrfs-devel at oss.oracle.com
>  >  http://oss.oracle.com/mailman/listinfo/btrfs-devel
>  >
>
>
>
>  --
>  Miguel Sousa Filipe
>



-- 
Regards,
Peter Teoh



More information about the Btrfs-devel mailing list