linux-mtd.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ubi : generate random image_seq when attaching empty MTD device
@ 2010-06-03 14:14 Matthieu CASTET
  2010-06-03 14:25 ` Artem Bityutskiy
  2010-06-08  8:45 ` Artem Bityutskiy
  0 siblings, 2 replies; 4+ messages in thread
From: Matthieu CASTET @ 2010-06-03 14:14 UTC (permalink / raw)
  To: linux-mtd@lists.infradead.org

[-- Attachment #1: Type: text/plain, Size: 151 bytes --]

generate random image_seq when attaching empty MTD device (kernel do the 
ubi formating).

Signed-off-by: Matthieu CASTET <matthieu.castet@parrot.com>

[-- Attachment #2: ubi.diff --]
[-- Type: text/x-diff, Size: 706 bytes --]

diff --git a/drivers/mtd/ubi/scan.c b/drivers/mtd/ubi/scan.c
index aed19f3..7a95ff3 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
@@ -935,8 +936,10 @@ struct ubi_scan_info *ubi_scan(struct ubi_device *ubi)
 	if (si->ec_count)
 		si->mean_ec = div_u64(si->ec_sum, si->ec_count);
 
-	if (si->is_empty)
+	if (si->is_empty) {
 		ubi_msg("empty MTD device detected");
+		get_random_bytes(&ubi->image_seq, sizeof(ubi->image_seq));
+	}
 
 	/*
 	 * Few corrupted PEBs are not a problem and may be just a result of

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2010-06-10 13:37 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-06-03 14:14 [PATCH] ubi : generate random image_seq when attaching empty MTD device Matthieu CASTET
2010-06-03 14:25 ` Artem Bityutskiy
2010-06-08  8:45 ` Artem Bityutskiy
2010-06-10 13:37   ` Matthieu CASTET

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).