diff options
author | Dan Carpenter <dan.carpenter@oracle.com> | 2012-01-30 02:59:49 -0500 |
---|---|---|
committer | Boaz Harrosh <bharrosh@panasas.com> | 2012-03-19 16:39:12 -0400 |
commit | 72749a270b6d254b4a018e290b853c27edb2fa62 (patch) | |
tree | cde350c359d5dc7328e6a96f867ca6d671b4bde8 /fs/exofs/super.c | |
parent | 3e57638bb1469ba2705456e9fd4063d1890341e1 (diff) |
exofs: Cap on the memcpy() size
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>
Diffstat (limited to 'fs/exofs/super.c')
-rw-r--r-- | fs/exofs/super.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/fs/exofs/super.c b/fs/exofs/super.c index d9619a577806..6c5397ad7a2a 100644 --- a/fs/exofs/super.c +++ b/fs/exofs/super.c | |||
@@ -529,7 +529,8 @@ static int exofs_devs_2_odi(struct exofs_dt_device_info *dt_dev, | |||
529 | struct osd_dev_info *odi) | 529 | struct osd_dev_info *odi) |
530 | { | 530 | { |
531 | odi->systemid_len = le32_to_cpu(dt_dev->systemid_len); | 531 | odi->systemid_len = le32_to_cpu(dt_dev->systemid_len); |
532 | memcpy(odi->systemid, dt_dev->systemid, odi->systemid_len); | 532 | if (likely(odi->systemid_len)) |
533 | memcpy(odi->systemid, dt_dev->systemid, OSD_SYSTEMID_LEN); | ||
533 | 534 | ||
534 | odi->osdname_len = le32_to_cpu(dt_dev->osdname_len); | 535 | odi->osdname_len = le32_to_cpu(dt_dev->osdname_len); |
535 | odi->osdname = dt_dev->osdname; | 536 | odi->osdname = dt_dev->osdname; |