From 05b289450b21f67f3cc0e7c9f91b63cf9c43d177 Mon Sep 17 00:00:00 2001 From: Timothy Day Date: Fri, 28 Jul 2023 04:49:50 +0000 Subject: [PATCH 1/1] LU-17000 misc: remove Coverity annotations 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 Change-Id: Ibcb9cf55574675e20b13a4f7a1b9142a3b75e262 Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/51793 Tested-by: jenkins Tested-by: Maloo Reviewed-by: Patrick Farrell Reviewed-by: James Simmons Reviewed-by: Oleg Drokin --- libcfs/libcfs/debug.c | 1 - lustre/ldlm/ldlm_lock.c | 1 - lustre/ldlm/ldlm_lockd.c | 2 -- lustre/ldlm/ldlm_request.c | 2 -- lustre/lod/lod_lov.c | 3 --- lustre/lod/lod_qos.c | 1 - lustre/lov/lov_obd.c | 1 - lustre/lov/lov_object.c | 1 - lustre/mdt/mdt_open.c | 1 - lustre/obdecho/echo_client.c | 4 ---- lustre/ptlrpc/client.c | 1 - lustre/utils/obd.c | 1 - 12 files changed, 19 deletions(-) diff --git a/libcfs/libcfs/debug.c b/libcfs/libcfs/debug.c index a0dbffa..8df44e5 100644 --- a/libcfs/libcfs/debug.c +++ b/libcfs/libcfs/debug.c @@ -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; diff --git a/lustre/ldlm/ldlm_lock.c b/lustre/ldlm/ldlm_lock.c index 8a8b4fe..849e039 100644 --- a/lustre/ldlm/ldlm_lock.c +++ b/lustre/ldlm/ldlm_lock.c @@ -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); } diff --git a/lustre/ldlm/ldlm_lockd.c b/lustre/ldlm/ldlm_lockd.c index f1c7b5a..d043760 100644 --- a/lustre/ldlm/ldlm_lockd.c +++ b/lustre/ldlm/ldlm_lockd.c @@ -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); } diff --git a/lustre/ldlm/ldlm_request.c b/lustre/ldlm/ldlm_request.c index fcd94b9..46ada0a 100644 --- a/lustre/ldlm/ldlm_request.c +++ b/lustre/ldlm/ldlm_request.c @@ -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, diff --git a/lustre/lod/lod_lov.c b/lustre/lod/lod_lov.c index b3322c5..388a562 100644 --- a/lustre/lod/lod_lov.c +++ b/lustre/lod/lod_lov.c @@ -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); } diff --git a/lustre/lod/lod_qos.c b/lustre/lod/lod_qos.c index bfcdb56..3d2741d 100644 --- a/lustre/lod/lod_qos.c +++ b/lustre/lod/lod_qos.c @@ -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); diff --git a/lustre/lov/lov_obd.c b/lustre/lov/lov_obd.c index 71c11a4..1376bb7 100644 --- a/lustre/lov/lov_obd.c +++ b/lustre/lov/lov_obd.c @@ -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); diff --git a/lustre/lov/lov_object.c b/lustre/lov/lov_object.c index 8093bdc..82673f3 100644 --- a/lustre/lov/lov_object.c +++ b/lustre/lov/lov_object.c @@ -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)); diff --git a/lustre/mdt/mdt_open.c b/lustre/mdt/mdt_open.c index 142a6f3..c7f9f22 100644 --- a/lustre/mdt/mdt_open.c +++ b/lustre/mdt/mdt_open.c @@ -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 { /* diff --git a/lustre/obdecho/echo_client.c b/lustre/obdecho/echo_client.c index b4eebe1..6c2f925 100644 --- a/lustre/obdecho/echo_client.c +++ b/lustre/obdecho/echo_client.c @@ -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); diff --git a/lustre/ptlrpc/client.c b/lustre/ptlrpc/client.c index 9bbc8d2..3167bf0 100644 --- a/lustre/ptlrpc/client.c +++ b/lustre/ptlrpc/client.c @@ -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); diff --git a/lustre/utils/obd.c b/lustre/utils/obd.c index 64a43de..936d253 100644 --- a/lustre/utils/obd.c +++ b/lustre/utils/obd.c @@ -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(); -- 1.8.3.1