summaryrefslogtreecommitdiff
path: root/drivers/mtd
diff options
context:
space:
mode:
authorMatthieu CASTET <matthieu.castet@parrot.com>2010-06-03 16:14:27 +0200
committerArtem Bityutskiy <Artem.Bityutskiy@nokia.com>2010-06-11 17:23:37 +0300
commit095751a6e0838a712393a74eb0b7b6559dbdbe81 (patch)
tree286ae0ee280545b85b7636cca91fb8e7f4efc859 /drivers/mtd
parent1a49af2ca019dcb4614c32f832bbcb814b61409c (diff)
downloadlinux-095751a6e0838a712393a74eb0b7b6559dbdbe81.tar.gz
linux-095751a6e0838a712393a74eb0b7b6559dbdbe81.tar.xz
UBI: generate random image_seq when formatting MTD devices
Generate random image_seq when attaching empty MTD device (kernel do the ubi formating). Signed-off-by: Matthieu CASTET <matthieu.castet@parrot.com> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Diffstat (limited to 'drivers/mtd')
-rw-r--r--drivers/mtd/ubi/scan.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/mtd/ubi/scan.c b/drivers/mtd/ubi/scan.c
index 6b7c0c4baf07..de7b2f1c4113 100644
--- a/drivers/mtd/ubi/scan.c
+++ b/drivers/mtd/ubi/scan.c
@@ -44,6 +44,7 @@
#include <linux/slab.h>
#include <linux/crc32.h>
#include <linux/math64.h>
+#include <linux/random.h>
#include "ubi.h"
#ifdef CONFIG_MTD_UBI_DEBUG_PARANOID
@@ -956,6 +957,7 @@ static int check_what_we_have(const struct ubi_device *ubi,
*/
si->is_empty = 1;
ubi_msg("empty MTD device detected");
+ get_random_bytes(&ubi->image_seq, sizeof(ubi->image_seq));
} else {
ubi_err("MTD device possibly contains non-UBI data, "
"refusing it");