Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 106067
b: refs/heads/master
c: a6ea440
h: refs/heads/master
i:
  106065: 9187094
  106063: 44741cb
v: v3
  • Loading branch information
Artem Bityutskiy authored and Artem Bityutskiy committed Jul 24, 2008
1 parent 652b1d1 commit c6e49c1
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: a5bf6190417cbbf80443a9f71c65b653e13e9982
refs/heads/master: a6ea440769e11c46828cddd20f91ab57261701d5
7 changes: 5 additions & 2 deletions trunk/drivers/mtd/ubi/cdev.c
Original file line number Diff line number Diff line change
Expand Up @@ -574,6 +574,10 @@ static int verify_mkvol_req(const struct ubi_device *ubi,
goto bad;
}

n = strnlen(req->name, req->name_len + 1);
if (n != req->name_len)
goto bad;

return 0;

bad:
Expand Down Expand Up @@ -629,12 +633,11 @@ static int ubi_cdev_ioctl(struct inode *inode, struct file *file,
break;
}

req.name[req.name_len] = '\0';
err = verify_mkvol_req(ubi, &req);
if (err)
break;

req.name[req.name_len] = '\0';

mutex_lock(&ubi->volumes_mutex);
err = ubi_create_volume(ubi, &req);
mutex_unlock(&ubi->volumes_mutex);
Expand Down
4 changes: 2 additions & 2 deletions trunk/drivers/mtd/ubi/vmt.c
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ int ubi_create_volume(struct ubi_device *ubi, struct ubi_mkvol_req *req)
vol->data_pad = ubi->leb_size % vol->alignment;
vol->vol_type = req->vol_type;
vol->name_len = req->name_len;
memcpy(vol->name, req->name, vol->name_len + 1);
memcpy(vol->name, req->name, vol->name_len);
vol->ubi = ubi;

/*
Expand Down Expand Up @@ -350,7 +350,7 @@ int ubi_create_volume(struct ubi_device *ubi, struct ubi_mkvol_req *req)
vtbl_rec.vol_type = UBI_VID_DYNAMIC;
else
vtbl_rec.vol_type = UBI_VID_STATIC;
memcpy(vtbl_rec.name, vol->name, vol->name_len + 1);
memcpy(vtbl_rec.name, vol->name, vol->name_len);

err = ubi_change_vtbl_record(ubi, vol_id, &vtbl_rec);
if (err)
Expand Down

0 comments on commit c6e49c1

Please sign in to comment.