Commit 59f41227 authored by Linus Torvalds's avatar Linus Torvalds

Merge branch 'for-linus' of git://git.infradead.org/ubi-2.6

* 'for-linus' of git://git.infradead.org/ubi-2.6:
  UBI: fix check on unsigned long
  UBI: fix backward compatibility
parents e281e315 774b1382
...@@ -42,6 +42,7 @@ ...@@ -42,6 +42,7 @@
#include <linux/log2.h> #include <linux/log2.h>
#include <linux/kthread.h> #include <linux/kthread.h>
#include <linux/reboot.h> #include <linux/reboot.h>
#include <linux/kernel.h>
#include "ubi.h" #include "ubi.h"
/* Maximum length of the 'mtd=' parameter */ /* Maximum length of the 'mtd=' parameter */
...@@ -1257,7 +1258,7 @@ static int __init bytes_str_to_int(const char *str) ...@@ -1257,7 +1258,7 @@ static int __init bytes_str_to_int(const char *str)
unsigned long result; unsigned long result;
result = simple_strtoul(str, &endp, 0); result = simple_strtoul(str, &endp, 0);
if (str == endp || result < 0) { if (str == endp || result >= INT_MAX) {
printk(KERN_ERR "UBI error: incorrect bytes count: \"%s\"\n", printk(KERN_ERR "UBI error: incorrect bytes count: \"%s\"\n",
str); str);
return -EINVAL; return -EINVAL;
......
...@@ -794,16 +794,15 @@ static int process_eb(struct ubi_device *ubi, struct ubi_scan_info *si, ...@@ -794,16 +794,15 @@ static int process_eb(struct ubi_device *ubi, struct ubi_scan_info *si,
* number. * number.
*/ */
image_seq = be32_to_cpu(ech->image_seq); image_seq = be32_to_cpu(ech->image_seq);
if (!si->image_seq_set) { if (!ubi->image_seq && image_seq)
ubi->image_seq = image_seq; ubi->image_seq = image_seq;
si->image_seq_set = 1; if (ubi->image_seq && image_seq &&
} else if (ubi->image_seq && ubi->image_seq != image_seq) { ubi->image_seq != image_seq) {
ubi_err("bad image sequence number %d in PEB %d, " ubi_err("bad image sequence number %d in PEB %d, "
"expected %d", image_seq, pnum, ubi->image_seq); "expected %d", image_seq, pnum, ubi->image_seq);
ubi_dbg_dump_ec_hdr(ech); ubi_dbg_dump_ec_hdr(ech);
return -EINVAL; return -EINVAL;
} }
} }
/* OK, we've done with the EC header, let's look at the VID header */ /* OK, we've done with the EC header, let's look at the VID header */
......
...@@ -103,7 +103,6 @@ struct ubi_scan_volume { ...@@ -103,7 +103,6 @@ struct ubi_scan_volume {
* @ec_sum: a temporary variable used when calculating @mean_ec * @ec_sum: a temporary variable used when calculating @mean_ec
* @ec_count: a temporary variable used when calculating @mean_ec * @ec_count: a temporary variable used when calculating @mean_ec
* @corr_count: count of corrupted PEBs * @corr_count: count of corrupted PEBs
* @image_seq_set: indicates @ubi->image_seq is known
* *
* This data structure contains the result of scanning and may be used by other * This data structure contains the result of scanning and may be used by other
* UBI sub-systems to build final UBI data structures, further error-recovery * UBI sub-systems to build final UBI data structures, further error-recovery
...@@ -127,7 +126,6 @@ struct ubi_scan_info { ...@@ -127,7 +126,6 @@ struct ubi_scan_info {
uint64_t ec_sum; uint64_t ec_sum;
int ec_count; int ec_count;
int corr_count; int corr_count;
int image_seq_set;
}; };
struct ubi_device; struct ubi_device;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment