Peter Teoh
2008-Mar-15 21:36 UTC
[Btrfs-devel] extent_io.c: bio_add_page() error check for bio ptr
bio_add_page() requires non-NULL bio ptr for dereferencing. Signed-off-by: Peter Teoh <htmldeveloper@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); 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
Miguel Figueiredo Mascarenhas Sousa Filipe
2008-Mar-16 09:22 UTC
[Btrfs-devel] extent_io.c: bio_add_page() error check for bio ptr
Hi, On Sun, Mar 16, 2008 at 4:36 AM, Peter Teoh <htmldeveloper@gmail.com> wrote:> bio_add_page() requires non-NULL bio ptr for dereferencing. > > Signed-off-by: Peter Teoh <htmldeveloper@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@oss.oracle.com > http://oss.oracle.com/mailman/listinfo/btrfs-devel >-- Miguel Sousa Filipe