]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
exofs: Cap on the memcpy() size
authorDan Carpenter <dan.carpenter@oracle.com>
Mon, 30 Jan 2012 07:59:49 +0000 (10:59 +0300)
committerBoaz Harrosh <bharrosh@panasas.com>
Mon, 19 Mar 2012 20:39:12 +0000 (13:39 -0700)
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>
fs/exofs/super.c

index d9619a577806898fbbaf86f52d6836b21024c172..6c5397ad7a2aa4e2e3f45f46e31c6f6e7da8cb1f 100644 (file)
@@ -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;