Skip to content

Commit

Permalink
UBI: fix buffer padding
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Kyungmin Park authored and Artem Bityutskiy committed Jul 24, 2008
1 parent beeea63 commit a0fd1ef
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions drivers/mtd/ubi/upd.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit a0fd1ef

Please sign in to comment.