Whamcloud - gitweb
LU-5352 dt: correct if condition in dt_index_read() 21/11121/6
authorJohn L. Hammond <john.hammond@intel.com>
Wed, 16 Jul 2014 20:35:33 +0000 (15:35 -0500)
committerAndreas Dilger <andreas.dilger@intel.com>
Sat, 25 Oct 2014 00:00:49 +0000 (00:00 +0000)
In dt_index_read() return -EPROTO if rdpg->rp_count is zero or is not
divisible by LU_PAGE_SIZE.

Signed-off-by: John L. Hammond <john.hammond@intel.com>
Change-Id: Ib4f884bf0759b81978336d68fea45cf7a5d8a70f
Reviewed-on: http://review.whamcloud.com/11121
Reviewed-by: Bob Glossman <bob.glossman@intel.com>
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Dmitry Eremin <dmitry.eremin@intel.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
lustre/obdclass/dt_object.c

index 4708a26..d6f82c7 100644 (file)
@@ -889,7 +889,7 @@ int dt_index_read(const struct lu_env *env, struct dt_device *dev,
 
        /* rp_count shouldn't be null and should be a multiple of the container
         * size */
-       if (rdpg->rp_count <= 0 && (rdpg->rp_count & (LU_PAGE_SIZE - 1)) != 0)
+       if (rdpg->rp_count == 0 || (rdpg->rp_count & (LU_PAGE_SIZE - 1)) != 0)
                RETURN(-EFAULT);
 
        if (!fid_is_quota(&ii->ii_fid) && !fid_is_layout_rbtree(&ii->ii_fid) &&