Whamcloud - gitweb
LU-17000 misc: remove Coverity annotations 93/51793/2
authorTimothy Day <timday@amazon.com>
Fri, 28 Jul 2023 04:49:50 +0000 (04:49 +0000)
committerOleg Drokin <green@whamcloud.com>
Thu, 31 Aug 2023 06:33:46 +0000 (06:33 +0000)
These Coverity function annotations were added
around 10 years ago. Since then, Coverity seems
to produce less false positives. Out of about 20
annotations, only 3 warnings get surpressed.
Thus, the applicability of these annotations
should be re-evaluated.

Coverity has more advanced tools now for reducing
false positives. Various Lustre functions and
macros could be modeled rather than using
function annotations. But first, we need to get
a good idea of what kinds of false postives are
being generated.

https://scan.coverity.com/tune

Test-Parameters: trivial
Signed-off-by: Timothy Day <timday@amazon.com>
Change-Id: Ibcb9cf55574675e20b13a4f7a1b9142a3b75e262
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/51793
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Patrick Farrell <pfarrell@whamcloud.com>
Reviewed-by: James Simmons <jsimmons@infradead.org>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
12 files changed:
libcfs/libcfs/debug.c
lustre/ldlm/ldlm_lock.c
lustre/ldlm/ldlm_lockd.c
lustre/ldlm/ldlm_request.c
lustre/lod/lod_lov.c
lustre/lod/lod_qos.c
lustre/lov/lov_obd.c
lustre/lov/lov_object.c
lustre/mdt/mdt_open.c
lustre/obdecho/echo_client.c
lustre/ptlrpc/client.c
lustre/utils/obd.c

index a0dbffa..8df44e5 100644 (file)
@@ -454,7 +454,6 @@ void libcfs_debug_dumplog(void)
 }
 EXPORT_SYMBOL(libcfs_debug_dumplog);
 
-/* coverity[+kill] */
 void __noreturn lbug_with_loc(struct libcfs_debug_msg_data *msgdata)
 {
        libcfs_catastrophe = 1;
index 8a8b4fe..849e039 100644 (file)
@@ -401,7 +401,6 @@ static int ldlm_lock_destroy_internal(struct ldlm_lock *lock)
                 * 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);
        }
index f1c7b5a..d043760 100644 (file)
@@ -1338,7 +1338,6 @@ int ldlm_handle_enqueue(struct ldlm_namespace *ns,
                 * 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) {
@@ -2756,7 +2755,6 @@ static int ldlm_revoke_lock_cb(struct cfs_hash *hs, struct cfs_hash_bd *bd,
                 * 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);
        }
index fcd94b9..46ada0a 100644 (file)
@@ -692,7 +692,6 @@ int ldlm_cli_enqueue_fini(struct obd_export *exp, struct req_capsule *pill,
                 * 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,
@@ -2517,7 +2516,6 @@ static int replay_lock_interpret(const struct lu_env *env,
                 * 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,
index b3322c5..388a562 100644 (file)
@@ -1133,7 +1133,6 @@ int lod_initialize_objects(const struct lu_env *env, struct lod_object *lo,
 
                /* 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));
@@ -1696,7 +1695,6 @@ static int lod_verify_v1v3(struct lod_device *d, const struct lu_buf *buf,
        lum3 = buf->lb_buf;
        /* In the function below, .hs_keycmp resolves to
         * pool_hashkey_keycmp() */
-       /* coverity[overrun-buffer-val] */
        pool = lod_find_pool(d, lum3->lmm_pool_name);
        if (pool == NULL)
                goto out;
@@ -2394,7 +2392,6 @@ int lod_pools_fini(struct lod_device *lod)
                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 bfcdb56..3d2741d 100644 (file)
@@ -2259,7 +2259,6 @@ static void lod_qos_set_pool(struct lod_object *lo, int pos, char *pool_name,
 
        /* In the function below, .hs_keycmp resolves to
         * pool_hashkey_keycmp() */
-       /* coverity[overrun-buffer-val] */
        if (pool_name)
                pool = lod_find_pool(d, pool_name);
 
index 71c11a4..1376bb7 100644 (file)
@@ -796,7 +796,6 @@ static int lov_cleanup(struct obd_device *obd)
                 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);
         }
        lov_pool_hash_destroy(&lov->lov_pools_hash_body);
index 8093bdc..82673f3 100644 (file)
@@ -257,7 +257,6 @@ static int lov_init_raid0(const struct lu_env *env, struct lov_device *dev,
                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))
                        GOTO(out, result = PTR_ERR(stripe));
index 142a6f3..c7f9f22 100644 (file)
@@ -1537,7 +1537,6 @@ again_pw:
                         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 {
                /*
index b4eebe1..6c2f925 100644 (file)
@@ -947,7 +947,6 @@ cl_echo_object_find(struct echo_device *d, const struct ost_id *oi)
         * 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);
@@ -1415,7 +1414,6 @@ static struct lu_object *echo_md_lookup(const struct lu_env *env,
         * 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);
@@ -1755,7 +1753,6 @@ static struct lu_object *echo_resolve_path(const struct lu_env *env,
         * 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",
@@ -1921,7 +1918,6 @@ static int echo_md_handler(struct echo_device *ed, int command,
                 * 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);
index 9bbc8d2..3167bf0 100644 (file)
@@ -134,7 +134,6 @@ struct ptlrpc_connection *ptlrpc_uuid_to_connection(struct obd_uuid *uuid,
         * ptlrpc_uuid_to_peer() initializes its 2nd parameter
         * before accessing its values.
         */
-       /* coverity[uninit_use_in_call] */
        err = ptlrpc_uuid_to_peer(uuid, &peer, &self, refnet);
        if (err != 0) {
                CNETERR("cannot find peer %s!\n", uuid->uuid);
index 64a43de..936d253 100644 (file)
@@ -3189,7 +3189,6 @@ void obd_finalize(int argc, char **argv)
        sigact.sa_handler = signal_server;
        sigfillset(&sigact.sa_mask);
        sigact.sa_flags = SA_RESTART;
-       /* coverity[uninit_use_in_call] */
        sigaction(SIGINT, &sigact, NULL);
 
        shmem_cleanup();