Whamcloud - gitweb
LU-2710 build: avoid function resolution mistakes by Coverity
authorSebastien Buisson <sebastien.buisson@bull.net>
Wed, 30 Jan 2013 15:32:27 +0000 (16:32 +0100)
committerOleg Drokin <oleg.drokin@intel.com>
Sat, 9 Feb 2013 03:21:35 +0000 (22:21 -0500)
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: Ie062b05a73db16d63c63db89dc4d0e264f3b1f8a
Reviewed-on: http://review.whamcloud.com/5211
Tested-by: Hudson
Reviewed-by: Keith Mannthey <keith.mannthey@intel.com>
Reviewed-by: Bob Glossman <bob.glossman@intel.com>
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
lustre/lod/lod_lov.c
lustre/lod/lod_qos.c
lustre/obdecho/echo_client.c

index 1d6986b..d477c88 100644 (file)
@@ -700,6 +700,9 @@ int lod_initialize_objects(const struct lu_env *env, struct lod_object *lo,
                nd = &OST_TGT(md,idx)->ltd_ost->dd_lu_dev;
                lod_putref(md, &md->lod_ost_descs);
 
+               /* In the function below, .hs_keycmp resolves to
+                * u_obj_hop_keycmp() */
+               /* coverity[overrun-buffer-val] */
                o = lu_object_find_at(env, nd, &info->lti_fid, NULL);
                if (IS_ERR(o))
                        GOTO(out, rc = PTR_ERR(o));
@@ -865,6 +868,9 @@ int lod_verify_striping(struct lod_device *d, const struct lu_buf *buf,
                v3 = buf->lb_buf;
 
        if (v3)
+               /* In the function below, .hs_keycmp resolves to
+                * pool_hashkey_keycmp() */
+               /* coverity[overrun-buffer-val] */
                pool = lod_find_pool(d, v3->lmm_pool_name);
 
        if (pool != NULL) {
@@ -1036,6 +1042,9 @@ int lod_pools_fini(struct lod_device *lod)
                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] */
                lod_pool_del(obd, pool->pool_name);
        }
 
index af0f9db..b1aa0c1 100644 (file)
@@ -1315,6 +1315,9 @@ static int lod_qos_parse_config(const struct lu_env *env,
                v3 = buf->lb_buf;
                lod_object_set_pool(lo, v3->lmm_pool_name);
 
+               /* In the function below, .hs_keycmp resolves to
+                * pool_hashkey_keycmp() */
+               /* coverity[overrun-buffer-val] */
                pool = lod_find_pool(d, v3->lmm_pool_name);
                if (pool != NULL) {
                        if (lo->ldo_def_stripe_offset !=
index a8f5b0b..fda4d54 100644 (file)
@@ -1748,6 +1748,9 @@ static struct lu_object *echo_md_lookup(const struct lu_env *env,
                 RETURN(ERR_PTR(rc));
         }
 
+       /* In the function below, .hs_keycmp resolves to
+        * lu_obj_hop_keycmp() */
+       /* coverity[overrun-buffer-val] */
         child = lu_object_find_at(env, &ed->ed_cl.cd_lu_dev, fid, NULL);
 
         RETURN(child);
@@ -2041,6 +2044,9 @@ static struct lu_object *echo_resolve_path(const struct lu_env *env,
                 RETURN(ERR_PTR(rc));
         }
 
+       /* In the function below, .hs_keycmp resolves to
+        * lu_obj_hop_keycmp() */
+       /* coverity[overrun-buffer-val] */
         parent = lu_object_find_at(env, &ed->ed_cl.cd_lu_dev, fid, NULL);
         if (IS_ERR(parent)) {
                 CERROR("Can not find the parent "DFID": rc = %ld\n",