just wondering about write_leb() in ubi/upd.c

Artem Bityutskiy dedekind at infradead.org
Tue Sep 30 01:35:56 EDT 2008


Hi,

On Mon, 2008-09-29 at 13:35 -0500, Monte Copeland wrote:
> I just fixed a bug in our older UBI version and decided to check the
> upstream.  Looking at the latest from kernel.org,
> I see in the write_leb() function in ubi/upd.c:
> 
>         if (vol->vol_type == UBI_DYNAMIC_VOLUME) {
>                 len = ALIGN(len, ubi->min_io_size);
>                 memset(buf + len, 0xFF, len - len);   <---- memset zero bytes?
> 
>                 len = ubi_calc_data_len(ubi, buf, len);
>                 if (len == 0) {
>                         dbg_msg("all %d bytes contain 0xFF - skip", len);
>                         return 0;
>                 }
> 
>                 err = ubi_eba_write_leb(ubi, vol, lnum, buf, 0, len,
> UBI_UNKNOWN);
>         } else {

Monte,

thanks for the report, but we fixed this already and the fix will show
up in 2.6.28. See

commit a0fd1efd488092951f310fdb777b8a540cf84dcb
Author: Kyungmin Park <kmpark at infradead.org>
Date:   Wed May 21 14:34:56 2008 +0300

    UBI: fix buffer padding

    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 at infradead.org>
    Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy at nokia.com>

-- 
Best regards,
Artem Bityutskiy (Битюцкий Артём)




More information about the linux-mtd mailing list