From ce3ffc233b09edc768e8157b98ec490a50e8d788 Mon Sep 17 00:00:00 2001 From: yidong0635 Date: Thu, 19 May 2022 14:02:48 +0800 Subject: [PATCH] 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 Change-Id: I98179ec76f2b6785b6921c37373204021c0669b6 Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/12737 Reviewed-by: Krzysztof Karas Reviewed-by: Jim Harris Community-CI: Broadcom CI Tested-by: SPDK CI Jenkins Reviewed-by: Ben Walker --- lib/blob/blobstore.c | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/blob/blobstore.c b/lib/blob/blobstore.c index 75e512f5f..f59852353 100644 --- a/lib/blob/blobstore.c +++ b/lib/blob/blobstore.c @@ -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); }