From: Dan Carpenter <dan.carpenter@oracle.com>
To: darrick.wong@oracle.com
Cc: linux-ext4@vger.kernel.org
Subject: re: ext4: make the bitmap read routines return real error codes
Date: Tue, 3 Nov 2015 15:04:45 +0300 [thread overview]
Message-ID: <20151103120445.GA20788@mwanda> (raw)
Hello Darrick J. Wong,
The patch 7d6232775976: "ext4: make the bitmap read routines return
real error codes" from Oct 17, 2015, leads to the following static
checker warning:
fs/ext4/mballoc.c:2989 ext4_mb_mark_diskspace_used()
error: 'bitmap_bh' dereferencing possible ERR_PTR()
fs/ext4/mballoc.c
2899 bitmap_bh = ext4_read_block_bitmap(sb, ac->ac_b_ex.fe_group);
2900 if (IS_ERR(bitmap_bh)) {
2901 err = PTR_ERR(bitmap_bh);
2902 goto out_err;
2903 }
2904
[ snip ]
2987
2988 out_err:
2989 brelse(bitmap_bh);
2990 return err;
2991 }
Also:
fs/ext4/mballoc.c:4894 ext4_free_blocks() error: 'bitmap_bh' dereferencing possible ERR_PTR()
fs/ext4/mballoc.c:5028 ext4_group_add_blocks() error: 'bitmap_bh' dereferencing possible ERR_PTR()
This is One Err style error handling where one error label handles every
possible error so it's error prone (handling every error is more
complicated than doing a specific thing).
The old code relied on the sanity check in brelse() to avoid NULL
dereferences but now we are passing ERR_PTRs so it's not enough.
Probably the fix is to update the sanity check in brelse(). Another
idea would be to not free things until they have been allocated.
regards,
dan carpenter
next reply other threads:[~2015-11-03 12:04 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-11-03 12:04 Dan Carpenter [this message]
2015-11-03 19:20 ` ext4: make the bitmap read routines return real error codes Darrick J. Wong
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=20151103120445.GA20788@mwanda \
--to=dan.carpenter@oracle.com \
--cc=darrick.wong@oracle.com \
--cc=linux-ext4@vger.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