examples/bdevperf: check the successful status before dereferencing the pointer

Issue here is that the status could be negative due to NULL pointer and in the
callback, the status is not checked before dereferencing the pointer which is
NULL here.

Change-Id: I7240fa91d1a640556e1f27b8295921c7dd1fb57f
Signed-off-by: GangCao <gang.cao@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/16176
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Shuhei Matsumoto <smatsumoto@nvidia.com>
Community-CI: Mellanox Build Bot
This commit is contained in:
GangCao 2023-01-09 02:00:44 -05:00 committed by Tomasz Zawadzki
parent 6665722214
commit 60fd5c554d

View File

@ -623,7 +623,10 @@ static void
bdevperf_channel_get_histogram_cb(void *cb_arg, int status, struct spdk_histogram_data *histogram)
{
struct spdk_histogram_data *job_hist = cb_arg;
spdk_histogram_data_merge(job_hist, histogram);
if (status == 0) {
spdk_histogram_data_merge(job_hist, histogram);
}
}
static void