From: Gao Xiang <gaoxiang25@huawei.com>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: miaoxie@huawei.com, xiang@kernel.org, linux-erofs@lists.ozlabs.org
Subject: Re: [bug report] staging: erofs: introduce erofs_grab_bio
Date: Wed, 28 Aug 2019 19:40:33 +0800 [thread overview]
Message-ID: <20190828114033.GB68628@architecture4> (raw)
In-Reply-To: <20190828113612.GB8372@kadam>
On Wed, Aug 28, 2019 at 02:36:13PM +0300, Dan Carpenter wrote:
> On Wed, Aug 28, 2019 at 07:02:49PM +0800, Gao Xiang wrote:
> > Hi Dan,
> >
> > On Wed, Aug 28, 2019 at 01:55:41PM +0300, Dan Carpenter wrote:
> > > Hello Gao Xiang,
> > >
> > > The patch 8be31270362b: "staging: erofs: introduce erofs_grab_bio"
> > > from Aug 21, 2018, leads to the following static checker warning:
> > >
> > > fs/erofs/zdata.c:1272 z_erofs_vle_submit_all()
> > > error: 'bio' dereferencing possible ERR_PTR()
> > >
> > > fs/erofs/zdata.c
> > > 1259 if (bio && force_submit) {
> > > 1260 submit_bio_retry:
> > > 1261 __submit_bio(bio, REQ_OP_READ, 0);
> > > 1262 bio = NULL;
> > > 1263 }
> > > 1264
> > > 1265 if (!bio) {
> > > 1266 bio = erofs_grab_bio(sb, first_index + i,
> > > 1267 BIO_MAX_PAGES, bi_private,
> > > 1268 z_erofs_vle_read_endio, true);
> > >
> > > This assumes erofs_grab_bio() can't fail. It returns ERR_PTR(-ENOMEM)
> > > on failure.
> >
> > I think there is no problem at all as well.
> > The last argument of erofs_grab_bio is nofail, and here is "true".
> >
> > 415 static inline struct bio *erofs_grab_bio(struct super_block *sb,
> > 416 erofs_blk_t blkaddr,
> > 417 unsigned int nr_pages,
> > 418 void *bi_private, bio_end_io_t endio,
> > 419 bool nofail)
> > 420 {
> > 421 const gfp_t gfp = GFP_NOIO;
> > 422 struct bio *bio;
> > 423
> > 424 do {
> > 425 if (nr_pages == 1) {
> > 426 bio = bio_alloc(gfp | (nofail ? __GFP_NOFAIL : 0), 1);
> > 427 if (unlikely(!bio)) {
> > 428 DBG_BUGON(nofail);
> > 429 return ERR_PTR(-ENOMEM);
> > 430 }
> > 431 break;
> > 432 }
> > 433 bio = bio_alloc(gfp, nr_pages);
> > 434 nr_pages /= 2;
> > 435 } while (unlikely(!bio));
> > 436
> > 437 bio->bi_end_io = endio;
> > 438 bio_set_dev(bio, sb->s_bdev);
> > 439 bio->bi_iter.bi_sector = (sector_t)blkaddr << LOG_SECTORS_PER_BLOCK;
> > 440 bio->bi_private = bi_private;
> > 441 return bio;
> > 442 }
> >
> > You can see __GFP_NOFAIL is set, Am I missing something?
> >
>
> Ah. Yes. You're right.
That is fine :) Thanks,
Cheers,
Gao Xiang
>
> regards,
> dan
>
>
next prev parent reply other threads:[~2019-08-28 11:41 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-08-28 10:55 [bug report] staging: erofs: introduce erofs_grab_bio Dan Carpenter
2019-08-28 11:02 ` Gao Xiang
2019-08-28 11:36 ` Dan Carpenter
2019-08-28 11:40 ` Gao Xiang [this message]
2019-08-28 11:39 ` Gao Xiang
2019-08-28 12:11 ` Dan Carpenter
2019-08-28 12:22 ` Gao Xiang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190828114033.GB68628@architecture4 \
--to=gaoxiang25@huawei.com \
--cc=dan.carpenter@oracle.com \
--cc=linux-erofs@lists.ozlabs.org \
--cc=miaoxie@huawei.com \
--cc=xiang@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox