lib/ftl: Check snprintf() return code

Change-Id: I711afcaabc079bc132cfdf2572683d0f0adff994
Signed-off-by: Wojciech Malikowski <wojciech.malikowski@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/481790
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com>
Community-CI: SPDK CI Jenkins <sys_sgci@intel.com>
This commit is contained in:
Wojciech Malikowski 2020-01-16 06:19:13 -05:00 committed by Jim Harris
parent 8c403acdb4
commit 49d0baee65

View File

@ -955,8 +955,14 @@ ftl_io_channel_create_cb(void *io_device, void *ctx)
struct spdk_ftl_dev *dev = io_device; struct spdk_ftl_dev *dev = io_device;
struct ftl_io_channel *ioch = ctx; struct ftl_io_channel *ioch = ctx;
char mempool_name[32]; char mempool_name[32];
int rc;
rc = snprintf(mempool_name, sizeof(mempool_name), "ftl_io_%p", ioch);
if (rc < 0 || rc >= (int)sizeof(mempool_name)) {
SPDK_ERRLOG("Failed to create IO channel pool name\n");
return -1;
}
snprintf(mempool_name, sizeof(mempool_name), "ftl_io_%p", ioch);
ioch->cache_ioch = NULL; ioch->cache_ioch = NULL;
ioch->dev = dev; ioch->dev = dev;
ioch->elem_size = sizeof(struct ftl_md_io); ioch->elem_size = sizeof(struct ftl_md_io);