summaryrefslogtreecommitdiff
path: root/ubi-utils/src/libubigen.c
diff options
context:
space:
mode:
authorArtem Bityutskiy <Artem.Bityutskiy@nokia.com>2009-05-11 19:22:34 +0300
committerArtem Bityutskiy <Artem.Bityutskiy@nokia.com>2009-05-11 19:22:34 +0300
commit21a8b9c2ac453dce1cfe26cca6f2ba14964c29f5 (patch)
treedf96c741b0f775a0bea221796945b23f89b40035 /ubi-utils/src/libubigen.c
parentdec7d7d8b1a42a927c497f120833166166d9c7f3 (diff)
ubi-utils: fix memory corruptions
This patch contains changes similar to the ones in the previous patch. Also, it changes all invocations of memset and makes sure the argument is 0, not '\0', because memset expects int, not char. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Diffstat (limited to 'ubi-utils/src/libubigen.c')
-rw-r--r--ubi-utils/src/libubigen.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/ubi-utils/src/libubigen.c b/ubi-utils/src/libubigen.c
index fddc1d8..a34963e 100644
--- a/ubi-utils/src/libubigen.c
+++ b/ubi-utils/src/libubigen.c
@@ -122,7 +122,7 @@ int ubigen_add_volume(const struct ubigen_info *ui,
return errmsg("too large alignment %d, max is %d (LEB size)",
vi->alignment, ui->leb_size);
- memset(vtbl_rec, '\0', sizeof(struct ubi_vtbl_record));
+ memset(vtbl_rec, 0, sizeof(struct ubi_vtbl_record));
tmp = (vi->bytes + ui->leb_size - 1) / ui->leb_size;
vtbl_rec->reserved_pebs = cpu_to_be32(tmp);
vtbl_rec->alignment = cpu_to_be32(vi->alignment);
@@ -151,7 +151,7 @@ void ubigen_init_ec_hdr(const struct ubigen_info *ui,
{
uint32_t crc;
- memset(hdr, '\0', sizeof(struct ubi_ec_hdr));
+ memset(hdr, 0, sizeof(struct ubi_ec_hdr));
hdr->magic = cpu_to_be32(UBI_EC_HDR_MAGIC);
hdr->version = ui->ubi_ver;
@@ -183,7 +183,7 @@ static void init_vid_hdr(const struct ubigen_info *ui,
{
uint32_t crc;
- memset(hdr, '\0', sizeof(struct ubi_vid_hdr));
+ memset(hdr, 0, sizeof(struct ubi_vid_hdr));
hdr->magic = cpu_to_be32(UBI_VID_HDR_MAGIC);
hdr->version = ui->ubi_ver;