aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ubifs
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2013-11-13 01:28:45 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2013-11-13 01:28:45 -0500
commitfbe43ff0031ded2b8500382da17d5d815a9c3edd (patch)
treebb10258396c467b83be10d1a3ee41ab33213cb1a /fs/ubifs
parenta7fa20a594fadf1e37cb3469c880ce6a544d3c3b (diff)
parent58a4e23703b22c331b01fbd0c12161aadaa6d50b (diff)
Merge tag 'upstream-3.13-rc1' of git://git.infradead.org/linux-ubifs
Pull ubifs changes from Artem Bityutskiy: "Mostly fixes for the power cut emulation UBIFS mode, and only one functional change which fixes a return error code" * tag 'upstream-3.13-rc1' of git://git.infradead.org/linux-ubifs: UBIFS: correct data corruption range UBIFS: fix return code UBIFS: remove unnecessary code in ubifs_garbage_collect
Diffstat (limited to 'fs/ubifs')
-rw-r--r--fs/ubifs/debug.c6
-rw-r--r--fs/ubifs/gc.c3
-rw-r--r--fs/ubifs/super.c8
3 files changed, 10 insertions, 7 deletions
diff --git a/fs/ubifs/debug.c b/fs/ubifs/debug.c
index 6e025e02ffde..cc1febd8fadf 100644
--- a/fs/ubifs/debug.c
+++ b/fs/ubifs/debug.c
@@ -2563,9 +2563,9 @@ static int corrupt_data(const struct ubifs_info *c, const void *buf,
2563 unsigned int from, to, ffs = chance(1, 2); 2563 unsigned int from, to, ffs = chance(1, 2);
2564 unsigned char *p = (void *)buf; 2564 unsigned char *p = (void *)buf;
2565 2565
2566 from = prandom_u32() % (len + 1); 2566 from = prandom_u32() % len;
2567 /* Corruption may only span one max. write unit */ 2567 /* Corruption span max to end of write unit */
2568 to = min(len, ALIGN(from, c->max_write_size)); 2568 to = min(len, ALIGN(from + 1, c->max_write_size));
2569 2569
2570 ubifs_warn("filled bytes %u-%u with %s", from, to - 1, 2570 ubifs_warn("filled bytes %u-%u with %s", from, to - 1,
2571 ffs ? "0xFFs" : "random data"); 2571 ffs ? "0xFFs" : "random data");
diff --git a/fs/ubifs/gc.c b/fs/ubifs/gc.c
index 76ca53cd3eee..9718da86ad01 100644
--- a/fs/ubifs/gc.c
+++ b/fs/ubifs/gc.c
@@ -668,8 +668,7 @@ int ubifs_garbage_collect(struct ubifs_info *c, int anyway)
668 ubifs_assert(!wbuf->used); 668 ubifs_assert(!wbuf->used);
669 669
670 for (i = 0; ; i++) { 670 for (i = 0; ; i++) {
671 int space_before = c->leb_size - wbuf->offs - wbuf->used; 671 int space_before, space_after;
672 int space_after;
673 672
674 cond_resched(); 673 cond_resched();
675 674
diff --git a/fs/ubifs/super.c b/fs/ubifs/super.c
index 3e4aa7281e04..f69daa514a57 100644
--- a/fs/ubifs/super.c
+++ b/fs/ubifs/super.c
@@ -1630,8 +1630,10 @@ static int ubifs_remount_rw(struct ubifs_info *c)
1630 } 1630 }
1631 1631
1632 c->write_reserve_buf = kmalloc(COMPRESSED_DATA_NODE_BUF_SZ, GFP_KERNEL); 1632 c->write_reserve_buf = kmalloc(COMPRESSED_DATA_NODE_BUF_SZ, GFP_KERNEL);
1633 if (!c->write_reserve_buf) 1633 if (!c->write_reserve_buf) {
1634 err = -ENOMEM;
1634 goto out; 1635 goto out;
1636 }
1635 1637
1636 err = ubifs_lpt_init(c, 0, 1); 1638 err = ubifs_lpt_init(c, 0, 1);
1637 if (err) 1639 if (err)
@@ -2064,8 +2066,10 @@ static int ubifs_fill_super(struct super_block *sb, void *data, int silent)
2064 } 2066 }
2065 2067
2066 sb->s_root = d_make_root(root); 2068 sb->s_root = d_make_root(root);
2067 if (!sb->s_root) 2069 if (!sb->s_root) {
2070 err = -ENOMEM;
2068 goto out_umount; 2071 goto out_umount;
2072 }
2069 2073
2070 mutex_unlock(&c->umount_mutex); 2074 mutex_unlock(&c->umount_mutex);
2071 return 0; 2075 return 0;