From 8b3533f5022bb186dd868187ed04df4a4812f542 Mon Sep 17 00:00:00 2001 From: wuzhouhui Date: Sun, 5 May 2019 17:58:14 +0800 Subject: [PATCH] lib/notify: fix checks in spdk_notify_type_register Adjusting error logs, by the way. Change-Id: I84ec84e550d9bc7249e0af423faa0ab81cf1c892 Signed-off-by: wuzhouhui Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/453142 Tested-by: SPDK CI Jenkins Reviewed-by: Ben Walker Reviewed-by: Jim Harris --- lib/notify/notify.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/lib/notify/notify.c b/lib/notify/notify.c index e1a3605ac..7fa9b83f1 100644 --- a/lib/notify/notify.c +++ b/lib/notify/notify.c @@ -62,9 +62,8 @@ spdk_notify_type_register(const char *type) if (!type) { SPDK_ERRLOG("Invalid notification type %p\n", type); return NULL; - } else if (!type || strlen(type) >= SPDK_NOTIFY_MAX_NAME_SIZE) { - SPDK_ERRLOG("Invalid notification type (add: %p, name: %s)\n", type, - type ? type : "(null)"); + } else if (!type[0] || strlen(type) >= SPDK_NOTIFY_MAX_NAME_SIZE) { + SPDK_ERRLOG("Notification type '%s' too short or too long\n", type); return NULL; }