linux-mtd.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Matthieu CASTET <matthieu.castet@parrot.com>
To: "linux-mtd@lists.infradead.org" <linux-mtd@lists.infradead.org>
Subject: [PATCH] ubi : generate random image_seq when attaching empty MTD device
Date: Thu, 3 Jun 2010 16:14:27 +0200	[thread overview]
Message-ID: <4C07B8C3.7080304@parrot.com> (raw)

[-- 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

             reply	other threads:[~2010-06-03 14:14 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-06-03 14:14 Matthieu CASTET [this message]
2010-06-03 14:25 ` [PATCH] ubi : generate random image_seq when attaching empty MTD device Artem Bityutskiy
2010-06-08  8:45 ` Artem Bityutskiy
2010-06-10 13:37   ` Matthieu CASTET

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4C07B8C3.7080304@parrot.com \
    --to=matthieu.castet@parrot.com \
    --cc=linux-mtd@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).