Skip to content

Commit

Permalink
UBI: generate random image_seq when formatting MTD devices
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Matthieu CASTET authored and Artem Bityutskiy committed Jun 11, 2010
1 parent 1a49af2 commit 095751a
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions drivers/mtd/ubi/scan.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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");
Expand Down

0 comments on commit 095751a

Please sign in to comment.