Skip to content

Commit

Permalink
exofs: Cap on the memcpy() size
Browse files Browse the repository at this point in the history
This data comes from the device, so probably it's fairly trustworthy but
it makes the static checkers happy if we check it.

[Boaz]
  the system_id_len is zero, if not present, or always OSD_SYSTEMID_LEN.
  So always copy OSD_SYSTEMID_LEN bytes.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Boaz Harrosh <bharrosh@panasas.com>
  • Loading branch information
Dan Carpenter authored and Boaz Harrosh committed Mar 19, 2012
1 parent 3e57638 commit 72749a2
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion fs/exofs/super.c
Original file line number Diff line number Diff line change
Expand Up @@ -529,7 +529,8 @@ static int exofs_devs_2_odi(struct exofs_dt_device_info *dt_dev,
struct osd_dev_info *odi)
{
odi->systemid_len = le32_to_cpu(dt_dev->systemid_len);
memcpy(odi->systemid, dt_dev->systemid, odi->systemid_len);
if (likely(odi->systemid_len))
memcpy(odi->systemid, dt_dev->systemid, OSD_SYSTEMID_LEN);

odi->osdname_len = le32_to_cpu(dt_dev->osdname_len);
odi->osdname = dt_dev->osdname;
Expand Down

0 comments on commit 72749a2

Please sign in to comment.