blobstore: Add assert in blob_id_cmp.

From the issue report in #2507
that comparing blob maybe be NULL.
So add assert, that in CI may catch this issue.
And other funtions add this also.

Signed-off-by: yidong0635 <dongx.yi@intel.com>
Change-Id: I98179ec76f2b6785b6921c37373204021c0669b6
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/12737
Reviewed-by: Krzysztof Karas <krzysztof.karas@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
This commit is contained in:
yidong0635 2022-05-19 14:02:48 +08:00 committed by Ben Walker
parent cb9e0db853
commit ce3ffc233b

View File

@ -68,6 +68,7 @@ blob_is_esnap_clone(const struct spdk_blob *blob)
static int
blob_id_cmp(struct spdk_blob *blob1, struct spdk_blob *blob2)
{
assert(blob1 != NULL && blob2 != NULL);
return (blob1->id < blob2->id ? -1 : blob1->id > blob2->id);
}