public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
* just wondering about write_leb() in ubi/upd.c
@ 2008-09-29 18:35 Monte Copeland
  2008-09-30  5:35 ` Artem Bityutskiy
  0 siblings, 1 reply; 2+ messages in thread
From: Monte Copeland @ 2008-09-29 18:35 UTC (permalink / raw)
  To: linux-mtd

Hi,

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: just wondering about write_leb() in ubi/upd.c
  2008-09-29 18:35 just wondering about write_leb() in ubi/upd.c Monte Copeland
@ 2008-09-30  5:35 ` Artem Bityutskiy
  0 siblings, 0 replies; 2+ messages in thread
From: Artem Bityutskiy @ 2008-09-30  5:35 UTC (permalink / raw)
  To: Monte Copeland; +Cc: linux-mtd

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

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2008-09-30  5:36 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-09-29 18:35 just wondering about write_leb() in ubi/upd.c Monte Copeland
2008-09-30  5:35 ` Artem Bityutskiy

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox