Remove function resolution mistakes made by Coverity version
6.0.3.
The .hs_keycmp function is incorrectly resolved by Coverity,
making the variable passed as its first 'key' parameter to
be considered of the wrong type. Data structures being of
different sizes, it ends up with this Coverity defect:
Out-of-bounds access (OVERRUN_STATIC)
Overrunning static array by passing it as an argument to a
function which indexes it at a higher byte position.
Signed-off-by: Sebastien Buisson <sebastien.buisson@bull.net>
Change-Id: Ia64d90f2faed17981cc4b4eaa960a797ab056daf
Reviewed-on: http://review.whamcloud.com/3955
Tested-by: Hudson
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: Keith Mannthey <keith@whamcloud.com>
Reviewed-by: Bob Glossman <bob.glossman@intel.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
if (lock->l_export && lock->l_export->exp_lock_hash) {
/* NB: it's safe to call cfs_hash_del() even lock isn't
* in exp_lock_hash. */
if (lock->l_export && lock->l_export->exp_lock_hash) {
/* NB: it's safe to call cfs_hash_del() even lock isn't
* in exp_lock_hash. */
+ /* In the function below, .hs_keycmp resolves to
+ * ldlm_export_lock_keycmp() */
+ /* coverity[overrun-buffer-val] */
cfs_hash_del(lock->l_export->exp_lock_hash,
&lock->l_remote_handle, &lock->l_exp_hash);
}
cfs_hash_del(lock->l_export->exp_lock_hash,
&lock->l_remote_handle, &lock->l_exp_hash);
}
if (unlikely(flags & LDLM_FL_REPLAY)) {
/* Find an existing lock in the per-export lock hash */
if (unlikely(flags & LDLM_FL_REPLAY)) {
/* Find an existing lock in the per-export lock hash */
+ /* In the function below, .hs_keycmp resolves to
+ * ldlm_export_lock_keycmp() */
+ /* coverity[overrun-buffer-val] */
lock = cfs_hash_lookup(req->rq_export->exp_lock_hash,
(void *)&dlm_req->lock_handle[0]);
if (lock != NULL) {
lock = cfs_hash_lookup(req->rq_export->exp_lock_hash,
(void *)&dlm_req->lock_handle[0]);
if (lock != NULL) {
if (lock->l_export && lock->l_export->exp_lock_hash) {
/* NB: it's safe to call cfs_hash_del() even lock isn't
* in exp_lock_hash. */
if (lock->l_export && lock->l_export->exp_lock_hash) {
/* NB: it's safe to call cfs_hash_del() even lock isn't
* in exp_lock_hash. */
+ /* In the function below, .hs_keycmp resolves to
+ * ldlm_export_lock_keycmp() */
+ /* coverity[overrun-buffer-val] */
cfs_hash_del(lock->l_export->exp_lock_hash,
&lock->l_remote_handle, &lock->l_exp_hash);
}
cfs_hash_del(lock->l_export->exp_lock_hash,
&lock->l_remote_handle, &lock->l_exp_hash);
}
lock_res_and_lock(lock);
/* Key change rehash lock in per-export hash with new key */
if (exp->exp_lock_hash) {
lock_res_and_lock(lock);
/* Key change rehash lock in per-export hash with new key */
if (exp->exp_lock_hash) {
+ /* In the function below, .hs_keycmp resolves to
+ * ldlm_export_lock_keycmp() */
+ /* coverity[overrun-buffer-val] */
cfs_hash_rehash_key(exp->exp_lock_hash,
&lock->l_remote_handle,
&reply->lock_handle,
cfs_hash_rehash_key(exp->exp_lock_hash,
&lock->l_remote_handle,
&reply->lock_handle,
/* Key change rehash lock in per-export hash with new key */
exp = req->rq_export;
if (exp && exp->exp_lock_hash) {
/* Key change rehash lock in per-export hash with new key */
exp = req->rq_export;
if (exp && exp->exp_lock_hash) {
+ /* In the function below, .hs_keycmp resolves to
+ * ldlm_export_lock_keycmp() */
+ /* coverity[overrun-buffer-val] */
cfs_hash_rehash_key(exp->exp_lock_hash,
&lock->l_remote_handle,
&reply->lock_handle,
cfs_hash_rehash_key(exp->exp_lock_hash,
&lock->l_remote_handle,
&reply->lock_handle,
pool = cfs_list_entry(pos, struct pool_desc, pool_list);
/* free pool structs */
CDEBUG(D_INFO, "delete pool %p\n", pool);
pool = cfs_list_entry(pos, struct pool_desc, pool_list);
/* free pool structs */
CDEBUG(D_INFO, "delete pool %p\n", pool);
+ /* In the function below, .hs_keycmp resolves to
+ * pool_hashkey_keycmp() */
+ /* coverity[overrun-buffer-val] */
lov_pool_del(obd, pool->pool_name);
}
cfs_hash_putref(lov->lov_pools_hash_body);
lov_pool_del(obd, pool->pool_name);
}
cfs_hash_putref(lov->lov_pools_hash_body);
subdev = lovsub2cl_dev(dev->ld_target[ost_idx]);
subconf->u.coc_oinfo = oinfo;
LASSERTF(subdev != NULL, "not init ost %d\n", ost_idx);
subdev = lovsub2cl_dev(dev->ld_target[ost_idx]);
subconf->u.coc_oinfo = oinfo;
LASSERTF(subdev != NULL, "not init ost %d\n", ost_idx);
+ /* In the function below, .hs_keycmp resolves to
+ * lu_obj_hop_keycmp() */
+ /* coverity[overrun-buffer-val] */
stripe = lov_sub_find(env, subdev, ofid, subconf);
if (!IS_ERR(stripe))
result = lov_init_sub(env, lov, stripe, r0, i);
stripe = lov_sub_find(env, subdev, ofid, subconf);
if (!IS_ERR(stripe))
result = lov_init_sub(env, lov, stripe, r0, i);
if (lmm_magic == LOV_USER_MAGIC_V3) {
struct pool_desc *pool;
if (lmm_magic == LOV_USER_MAGIC_V3) {
struct pool_desc *pool;
+ /* In the function below, .hs_keycmp resolves to
+ * pool_hashkey_keycmp() */
+ /* coverity[overrun-buffer-val] */
pool = lov_find_pool(lov, lumv3->lmm_pool_name);
if (pool != NULL) {
if (lumv3->lmm_stripe_offset !=
pool = lov_find_pool(lov, lumv3->lmm_pool_name);
if (pool != NULL) {
if (lumv3->lmm_stripe_offset !=
ENTRY;
/* First check whether we can create the objects on the pool */
ENTRY;
/* First check whether we can create the objects on the pool */
+ /* In the function below, .hs_keycmp resolves to
+ * pool_hashkey_keycmp() */
+ /* coverity[overrun-buffer-val] */
pool = lov_find_pool(lov, lsm->lsm_pool_name);
if (pool != NULL) {
cfs_down_read(&pool_tgt_rw_sem(pool));
pool = lov_find_pool(lov, lsm->lsm_pool_name);
if (pool != NULL) {
cfs_down_read(&pool_tgt_rw_sem(pool));
struct ost_pool *osts;
ENTRY;
struct ost_pool *osts;
ENTRY;
+ /* In the function below, .hs_keycmp resolves to
+ * pool_hashkey_keycmp() */
+ /* coverity[overrun-buffer-val] */
pool = lov_find_pool(lov, lsm->lsm_pool_name);
if (pool == NULL) {
osts = &(lov->lov_packed);
pool = lov_find_pool(lov, lsm->lsm_pool_name);
if (pool == NULL) {
osts = &(lov->lov_packed);
if (newea ||
lsm->lsm_oinfo[0]->loi_ost_idx >= lov->desc.ld_tgt_count)
if (newea ||
lsm->lsm_oinfo[0]->loi_ost_idx >= lov->desc.ld_tgt_count)
+ /* In the function below, .hs_keycmp resolves to
+ * pool_hashkey_keycmp() */
+ /* coverity[overrun-buffer-val] */
rc = alloc_qos(exp, tmp_arr, &stripe_cnt,
lsm->lsm_pool_name, flags);
else
rc = alloc_qos(exp, tmp_arr, &stripe_cnt,
lsm->lsm_pool_name, flags);
else
dlmreq = req_capsule_client_get(info->mti_pill, &RMF_DLM_REQ);
remote_hdl = dlmreq->lock_handle[0];
dlmreq = req_capsule_client_get(info->mti_pill, &RMF_DLM_REQ);
remote_hdl = dlmreq->lock_handle[0];
+ /* In the function below, .hs_keycmp resolves to
+ * ldlm_export_lock_keycmp() */
+ /* coverity[overrun-buffer-val] */
lock = cfs_hash_lookup(exp->exp_lock_hash, &remote_hdl);
if (lock) {
if (lock != new_lock) {
lock = cfs_hash_lookup(exp->exp_lock_hash, &remote_hdl);
if (lock) {
if (lock != new_lock) {
*child_fid = *info->mti_rr.rr_fid2;
LASSERTF(fid_is_sane(child_fid), "fid="DFID"\n",
PFID(child_fid));
*child_fid = *info->mti_rr.rr_fid2;
LASSERTF(fid_is_sane(child_fid), "fid="DFID"\n",
PFID(child_fid));
+ /* In the function below, .hs_keycmp resolves to
+ * lu_obj_hop_keycmp() */
+ /* coverity[overrun-buffer-val] */
child = mdt_object_new(info->mti_env, mdt, child_fid);
} else {
/*
child = mdt_object_new(info->mti_env, mdt, child_fid);
} else {
/*
fid = &info->eti_fid;
lsm2fid(lsm, fid);
fid = &info->eti_fid;
lsm2fid(lsm, fid);
+ /* In the function below, .hs_keycmp resolves to
+ * lu_obj_hop_keycmp() */
+ /* coverity[overrun-buffer-val] */
obj = cl_object_find(env, echo_dev2cl(d), fid, &conf->eoc_cl);
if (IS_ERR(obj))
GOTO(out, eco = (void*)obj);
obj = cl_object_find(env, echo_dev2cl(d), fid, &conf->eoc_cl);
if (IS_ERR(obj))
GOTO(out, eco = (void*)obj);
fid->f_seq = data->ioc_obdo1.o_seq;
fid->f_oid = (__u32)data->ioc_obdo1.o_id;
fid->f_ver = 0;
fid->f_seq = data->ioc_obdo1.o_seq;
fid->f_oid = (__u32)data->ioc_obdo1.o_id;
fid->f_ver = 0;
+ /* In the function below, .hs_keycmp resolves to
+ * lu_obj_hop_keycmp() */
+ /* coverity[overrun-buffer-val] */
rc = echo_create_md_object(env, ed, parent, fid, name, namelen,
id, mode, count, stripe_count,
stripe_index);
rc = echo_create_md_object(env, ed, parent, fid, name, namelen,
id, mode, count, stripe_count,
stripe_index);
* connection. The object which exists in the has will be
* returned and may be compared against out object.
*/
* connection. The object which exists in the has will be
* returned and may be compared against out object.
*/
+ /* In the function below, .hs_keycmp resolves to
+ * conn_keycmp() */
+ /* coverity[overrun-buffer-val] */
conn2 = cfs_hash_findadd_unique(conn_hash, &peer, &conn->c_hash);
if (conn != conn2) {
OBD_FREE_PTR(conn);
conn2 = cfs_hash_findadd_unique(conn_hash, &peer, &conn->c_hash);
if (conn != conn2) {
OBD_FREE_PTR(conn);