Commit add69d22 authored by Dmitry Eremin's avatar Dmitry Eremin Committed by Greg Kroah-Hartman

staging: lustre: fix framework.c issues found by Klocwork Insight tool

The functions sfw_test_buffers() and sfw_unload_test() from LNet
selftest both assume sfw_test_instance_t being passed in is never
null. This is corrected here.
Signed-off-by: default avatarDmitry Eremin <dmitry.eremin@intel.com>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-4629
Reviewed-on: http://review.whamcloud.com/9386Reviewed-by: default avatarJohn L. Hammond <john.hammond@intel.com>
Reviewed-by: default avatarIsaac Huang <he.huang@intel.com>
Reviewed-by: default avatarOleg Drokin <oleg.drokin@intel.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 95193044
...@@ -541,10 +541,16 @@ sfw_test_rpc_fini(srpc_client_rpc_t *rpc) ...@@ -541,10 +541,16 @@ sfw_test_rpc_fini(srpc_client_rpc_t *rpc)
static inline int static inline int
sfw_test_buffers(sfw_test_instance_t *tsi) sfw_test_buffers(sfw_test_instance_t *tsi)
{ {
struct sfw_test_case *tsc = sfw_find_test_case(tsi->tsi_service); struct sfw_test_case *tsc;
struct srpc_service *svc = tsc->tsc_srv_service; struct srpc_service *svc;
int nbuf; int nbuf;
LASSERT(tsi);
tsc = sfw_find_test_case(tsi->tsi_service);
LASSERT(tsc);
svc = tsc->tsc_srv_service;
LASSERT(svc);
nbuf = min(svc->sv_wi_total, tsi->tsi_loop) / svc->sv_ncpts; nbuf = min(svc->sv_wi_total, tsi->tsi_loop) / svc->sv_ncpts;
return max(SFW_TEST_WI_MIN, nbuf + SFW_TEST_WI_EXTRA); return max(SFW_TEST_WI_MIN, nbuf + SFW_TEST_WI_EXTRA);
} }
...@@ -591,8 +597,10 @@ sfw_load_test(struct sfw_test_instance *tsi) ...@@ -591,8 +597,10 @@ sfw_load_test(struct sfw_test_instance *tsi)
static void static void
sfw_unload_test(struct sfw_test_instance *tsi) sfw_unload_test(struct sfw_test_instance *tsi)
{ {
struct sfw_test_case *tsc = sfw_find_test_case(tsi->tsi_service); struct sfw_test_case *tsc;
LASSERT(tsi);
tsc = sfw_find_test_case(tsi->tsi_service);
LASSERT(tsc); LASSERT(tsc);
if (tsi->tsi_is_client) if (tsi->tsi_is_client)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment