Commit 1a1a8e89 authored by Ziye Yang's avatar Ziye Yang Committed by Ben Walker
Browse files

test/scsi: Assert callocs do not return NULL



Change-Id: I4cf2027c5fbb09e8c451d4c9c40ccee2f55973f2
Signed-off-by: default avatarZiye Yang <ziye.yang@intel.com>
parent 4ed88709
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -37,6 +37,7 @@ include $(SPDK_ROOT_DIR)/mk/spdk.app.mk

SPDK_LIB_LIST = log

CFLAGS += -I$(SPDK_ROOT_DIR)/test
CFLAGS += -I$(SPDK_ROOT_DIR)/lib/scsi
LIBS += $(SPDK_LIB_LINKER_ARGS)
LIBS += -lcunit
+5 −0
Original line number Diff line number Diff line
@@ -36,6 +36,7 @@
#include <string.h>

#include "CUnit/Basic.h"
#include "spdk_cunit.h"

#include "dev.c"
#include "port.c"
@@ -92,6 +93,8 @@ spdk_scsi_lun_construct(const char *name, struct spdk_bdev *bdev)
	struct spdk_scsi_lun *lun;

	lun = calloc(1, sizeof(struct spdk_scsi_lun));
	SPDK_CU_ASSERT_FATAL(lun != NULL);

	snprintf(lun->name, sizeof(lun->name), "%s", name);
	lun->bdev = bdev;
	return lun;
@@ -123,6 +126,8 @@ spdk_scsi_lun_claim(struct spdk_scsi_lun *lun)
	}

	p = calloc(1, sizeof(struct lun_entry));
	SPDK_CU_ASSERT_FATAL(p != NULL);

	p->lun = lun;

	TAILQ_INSERT_TAIL(&g_lun_head, p, lun_entries);