From: Dave Jones <davej@redhat.com>
To: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Cc: clm@fb.com, jeffm@suse.com
Subject: Re: btrfs: add ability to change features via sysfs
Date: Fri, 31 Jan 2014 10:35:35 -0500 [thread overview]
Message-ID: <20140131153535.GA30957@redhat.com> (raw)
In-Reply-To: <20140131041200.7E860660C9D@gitolite.kernel.org>
On Fri, Jan 31, 2014 at 04:12:00AM +0000, Linux Kernel wrote:
> Gitweb: http://git.kernel.org/linus/;a=commit;h=ba631941ef09c10e229661219dbd1707e56131d8
> Commit: ba631941ef09c10e229661219dbd1707e56131d8
> Parent: 79da4fa4d9dcf8c948ef8b5848f747ef08f6e732
> Author: Jeff Mahoney <jeffm@suse.com>
> AuthorDate: Fri Nov 1 13:07:01 2013 -0400
> Committer: Chris Mason <clm@fb.com>
> CommitDate: Tue Jan 28 13:19:27 2014 -0800
>
> btrfs: add ability to change features via sysfs
> +static int can_modify_feature(struct btrfs_feature_attr *fa)
> +{
> + int val = 0;
> + u64 set, clear;
> + switch (fa->feature_set) {
> + case FEAT_COMPAT:
> + set = BTRFS_FEATURE_COMPAT_SAFE_SET;
> + clear = BTRFS_FEATURE_COMPAT_SAFE_CLEAR;
> + break;
> + case FEAT_COMPAT_RO:
> + set = BTRFS_FEATURE_COMPAT_RO_SAFE_SET;
> + clear = BTRFS_FEATURE_COMPAT_RO_SAFE_CLEAR;
> + break;
> + case FEAT_INCOMPAT:
> + set = BTRFS_FEATURE_INCOMPAT_SAFE_SET;
> + clear = BTRFS_FEATURE_INCOMPAT_SAFE_CLEAR;
> + break;
> + default:
> + BUG();
> + }
> +
> + if (set & fa->feature_bit)
> + val |= 1;
> + if (clear & fa->feature_bit)
> + val |= 2;
> +
> + return val;
> +}
Coverity flagged 9 new issues in btrfs last night.
It flagged this (and a bunch of similar areas) because the CLEAR defines are 0.
Doing if (0 & fa->feature_bit) is always going to be false.
There's 72 other btrfs bugs at http://scan.coverity.com (twice that of say, ext* or xfs).
Many of them look real, though some look complicated enough that they really need
someone familiar with how btrfs works to know "can't happen". If some of you want
to sign up, I can get the access approved quickly.
thanks,
Dave
parent reply other threads:[~2014-01-31 15:35 UTC|newest]
Thread overview: expand[flat|nested] mbox.gz Atom feed
[parent not found: <20140131041200.7E860660C9D@gitolite.kernel.org>]
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=20140131153535.GA30957@redhat.com \
--to=davej@redhat.com \
--cc=clm@fb.com \
--cc=jeffm@suse.com \
--cc=linux-kernel@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.