提交 095751a6 编写于 作者: M Matthieu CASTET 提交者: Artem Bityutskiy

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: NMatthieu CASTET <matthieu.castet@parrot.com>
Signed-off-by: NArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
上级 1a49af2c
...@@ -44,6 +44,7 @@ ...@@ -44,6 +44,7 @@
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/crc32.h> #include <linux/crc32.h>
#include <linux/math64.h> #include <linux/math64.h>
#include <linux/random.h>
#include "ubi.h" #include "ubi.h"
#ifdef CONFIG_MTD_UBI_DEBUG_PARANOID #ifdef CONFIG_MTD_UBI_DEBUG_PARANOID
...@@ -956,6 +957,7 @@ static int check_what_we_have(const struct ubi_device *ubi, ...@@ -956,6 +957,7 @@ static int check_what_we_have(const struct ubi_device *ubi,
*/ */
si->is_empty = 1; si->is_empty = 1;
ubi_msg("empty MTD device detected"); ubi_msg("empty MTD device detected");
get_random_bytes(&ubi->image_seq, sizeof(ubi->image_seq));
} else { } else {
ubi_err("MTD device possibly contains non-UBI data, " ubi_err("MTD device possibly contains non-UBI data, "
"refusing it"); "refusing it");
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册