Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1420137

[PATCH 1/3] befs: check return of sb_min_blocksize

From Luis de Bethencourt <luisbg@osg.samsung.com>
Newsgroups linux.kernel
Subject [PATCH 1/3] befs: check return of sb_min_blocksize
Date 2016-06-12 05:00 +0200
Message-ID <rJ3MZ-2Xu-15@gated-at.bofh.it> (permalink)
Organization linux.* mail to news gateway

Show all headers | View raw


Confirm sb_min_blocksize() succeeded before continuing.

Signed-off-by: Luis de Bethencourt <luisbg@osg.samsung.com>
---
Hi,

This is the main fix I wanted to send. I noticed other file systems check
the return of sb_min_blocksize(), it can fail so it is worth checking before
continuing.

Thanks :)
Luis

 fs/befs/linuxvfs.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/fs/befs/linuxvfs.c b/fs/befs/linuxvfs.c
index c734f21..453bb68 100644
--- a/fs/befs/linuxvfs.c
+++ b/fs/befs/linuxvfs.c
@@ -756,6 +756,7 @@ befs_fill_super(struct super_block *sb, void *data, int silent)
 	long ret = -EINVAL;
 	const unsigned long sb_block = 0;
 	const off_t x86_sb_off = 512;
+	int blocksize;
 
 	save_mount_options(sb, data);
 
@@ -788,7 +789,11 @@ befs_fill_super(struct super_block *sb, void *data, int silent)
 	 * least 1k to get the second 512 bytes of the volume.
 	 * -WD 10-26-01
 	 */ 
-	sb_min_blocksize(sb, 1024);
+	blocksize = sb_min_blocksize(sb, 1024);
+	if (!blocksize) {
+		befs_error(sb, "unable to set blocksize");
+		goto unacquire_priv_sbp;
+	}
 
 	if (!(bh = sb_bread(sb, sb_block))) {
 		if (!silent)
-- 
2.5.1

Back to linux.kernel | Previous | NextNext in thread | Find similar | Unroll thread


Thread

[PATCH 1/3] befs: check return of sb_min_blocksize Luis de Bethencourt <luisbg@osg.samsung.com> - 2016-06-12 05:00 +0200
  [PATCH 2/3] befs: fix function name in documentation Luis de Bethencourt <luisbg@osg.samsung.com> - 2016-06-12 05:00 +0200
  [PATCH 3/3] befs: remove unused functions Luis de Bethencourt <luisbg@osg.samsung.com> - 2016-06-12 05:00 +0200

csiph-web