Skip to content

Commit aa60cdb

Browse files
committed
fabrics: add missing default context assignment
The config line parser wants to access the default fabrics configuration for every connection attempt. Thus assign the pointer to the helper struct to avoid NULL pointer access. Reported-by: Martin George <[email protected]> Signed-off-by: Daniel Wagner <[email protected]>
1 parent 5aef13b commit aa60cdb

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

fabrics.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ static int setup_common_context(struct nvmf_context *fctx,
172172
struct fabric_args *fa);
173173

174174
struct cb_fabrics_data {
175-
struct nvme_fabrics_config *defcfg;
175+
struct nvme_fabrics_config *cfg;
176176
nvme_print_flags_t flags;
177177
char *raw;
178178
char **argv;
@@ -281,7 +281,7 @@ static int cb_parser_next_line(struct nvmf_context *fctx, void *user_data)
281281
OPT_FLAG("persistent", 'p', &persistent, "persistent discovery connection"),
282282
OPT_FLAG("force", 0, &force, "Force persistent discovery controller creation"));
283283

284-
memcpy(&cfg, cfd->defcfg, sizeof(cfg));
284+
memcpy(&cfg, cfd->cfg, sizeof(cfg));
285285
next:
286286
if (fgets(line, sizeof(line), cfd->f) == NULL)
287287
return -EOF;
@@ -549,6 +549,7 @@ int fabrics_discovery(const char *desc, int argc, char **argv, bool connect)
549549
}
550550

551551
struct cb_fabrics_data dld = {
552+
.cfg = &cfg,
552553
.flags = flags,
553554
.raw = raw,
554555
};

0 commit comments

Comments
 (0)