diff --git a/drivers/mtd/mtd_config_fs.c b/drivers/mtd/mtd_config_fs.c index 5e47147034..6c45c5af38 100644 --- a/drivers/mtd/mtd_config_fs.c +++ b/drivers/mtd/mtd_config_fs.c @@ -1750,7 +1750,7 @@ static ssize_t nvs_read(FAR struct nvs_fs *fs, uint8_t key[sizeof(pdata->id) + sizeof(pdata->instance)]; #endif - if (pdata == NULL || pdata->len == 0) + if (pdata == NULL || pdata->len == 0 || pdata->configdata == NULL) { return -EINVAL; } @@ -1798,6 +1798,11 @@ static int nvs_next(FAR struct nvs_fs *fs, struct nvs_ate step_ate; uint32_t rd_addr; + if (pdata == NULL || pdata->len == 0 || pdata->configdata == NULL) + { + return -EINVAL; + } + #ifdef CONFIG_MTD_CONFIG_NAMED FAR uint8_t *key = (FAR uint8_t *)pdata->name; #else