summaryrefslogtreecommitdiffstats
path: root/fs/ubifs/debug.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2013-11-13 07:28:45 +0100
committerLinus Torvalds <torvalds@linux-foundation.org>2013-11-13 07:28:45 +0100
commitfbe43ff0031ded2b8500382da17d5d815a9c3edd (patch)
treebb10258396c467b83be10d1a3ee41ab33213cb1a /fs/ubifs/debug.c
parentMerge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/msz... (diff)
parentUBIFS: correct data corruption range (diff)
downloadlinux-fbe43ff0031ded2b8500382da17d5d815a9c3edd.tar.xz
linux-fbe43ff0031ded2b8500382da17d5d815a9c3edd.zip
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/debug.c')
-rw-r--r--fs/ubifs/debug.c6
1 files changed, 3 insertions, 3 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,
unsigned int from, to, ffs = chance(1, 2);
unsigned char *p = (void *)buf;
- from = prandom_u32() % (len + 1);
- /* Corruption may only span one max. write unit */
- to = min(len, ALIGN(from, c->max_write_size));
+ from = prandom_u32() % len;
+ /* Corruption span max to end of write unit */
+ to = min(len, ALIGN(from + 1, c->max_write_size));
ubifs_warn("filled bytes %u-%u with %s", from, to - 1,
ffs ? "0xFFs" : "random data");