]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
UBI: fix buffer padding
authorKyungmin Park <kmpark@infradead.org>
Wed, 21 May 2008 11:34:56 +0000 (14:34 +0300)
committerArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
Thu, 24 Jul 2008 10:32:54 +0000 (13:32 +0300)
Instead of correctly pad the buffer wich we are writing to the
eraseblock during update, we used weird construct:

memset(buf + len, 0xFF, len - len);

Fix this.

Signed-off-by: Kyungmin Park <kmpark@infradead.org>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
drivers/mtd/ubi/upd.c

index ddaa1a56cc692d278f16e1f92cc9a799fcd72b90..6fa1ab3f2a7022d8f0fe0755beb12977d67c70a9 100644 (file)
@@ -237,10 +237,10 @@ static int write_leb(struct ubi_device *ubi, struct ubi_volume *vol, int lnum,
        int err;
 
        if (vol->vol_type == UBI_DYNAMIC_VOLUME) {
-               len = ALIGN(len, ubi->min_io_size);
-               memset(buf + len, 0xFF, len - len);
+               int l = ALIGN(len, ubi->min_io_size);
 
-               len = ubi_calc_data_len(ubi, buf, len);
+               memset(buf + len, 0xFF, l - len);
+               len = ubi_calc_data_len(ubi, buf, l);
                if (len == 0) {
                        dbg_msg("all %d bytes contain 0xFF - skip", len);
                        return 0;