All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] btrfs: replace BUG in can_modify_feature
@ 2013-11-19 12:36 David Sterba
  0 siblings, 0 replies; only message in thread
From: David Sterba @ 2013-11-19 12:36 UTC (permalink / raw)
  To: linux-btrfs; +Cc: David Sterba

We don't need to crash hard here, it's just reading a sysfs file. The
values considered in switch are from a fixed set, the default case
should not happen at all.

Signed-off-by: David Sterba <dsterba@suse.cz>
---
 fs/btrfs/sysfs.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/fs/btrfs/sysfs.c b/fs/btrfs/sysfs.c
index 669fdf777b6c..20a9bafeca78 100644
--- a/fs/btrfs/sysfs.c
+++ b/fs/btrfs/sysfs.c
@@ -75,7 +75,9 @@ static int can_modify_feature(struct btrfs_feature_attr *fa)
 		clear = BTRFS_FEATURE_INCOMPAT_SAFE_CLEAR;
 		break;
 	default:
-		BUG();
+		printk(KERN_WARNING "btrfs: sysfs: unknown feature set %d\n",
+				fa->feature_set);
+		return 0;
 	}
 
 	if (set & fa->feature_bit)
-- 
1.8.4.2


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2013-11-19 12:36 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-11-19 12:36 [PATCH] btrfs: replace BUG in can_modify_feature David Sterba

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.