Message ID | 4C07B8C3.7080304@parrot.com |
---|---|
State | New, archived |
Headers | show |
On Thu, 2010-06-03 at 16:14 +0200, Matthieu CASTET wrote: > generate random image_seq when attaching empty MTD device (kernel do the > ubi formating). > > Signed-off-by: Matthieu CASTET <matthieu.castet@parrot.com> Looks OK, I'll push it to the UBI tree as soon as I have time - very busy right now, thanks.
On Thu, 2010-06-03 at 16:14 +0200, Matthieu CASTET wrote: > generate random image_seq when attaching empty MTD device (kernel do the > ubi formating). Your patch did not apply to the ubi-2.6.git master, because it conflicted with my latest changes. But I amended it and pushed, but you should probably check. Thanks.
Artem Bityutskiy a écrit : > On Thu, 2010-06-03 at 16:14 +0200, Matthieu CASTET wrote: >> generate random image_seq when attaching empty MTD device (kernel do the >> ubi formating). > > Your patch did not apply to the ubi-2.6.git master, because it > conflicted with my latest changes. But I amended it and pushed, but you > should probably check. > It looks fine. Thanks.
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
generate random image_seq when attaching empty MTD device (kernel do the ubi formating). Signed-off-by: Matthieu CASTET <matthieu.castet@parrot.com>