From ea9dda30e22c18460bdfce350bb4e0bae79c235d Mon Sep 17 00:00:00 2001 From: Peter Schneider Date: Thu, 22 Mar 2018 00:28:32 +0100 Subject: [PATCH] pmc_common: Preset uninitialized 'iface.ts_label' with 'iface.name' pmc_create() calls transport_create(), which sets the open function for the interface 'iface' to raw_open(), if Layer 2 is used. The immediate following call of transport_open() calls raw_open(), which uses the field .ts_label for opening, instead of the field .name (which is used in the other transport layers). Therefore, the field .name is copied here into the field .ts_label . [ RC - Actually ts_label should always be initialized. Made the assignment of ts_label unconditional, regardless of the choice of transport layer. ] Signed-off-by: Peter Schneider Signed-off-by: Richard Cochran --- pmc_common.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pmc_common.c b/pmc_common.c index 91fffb3..22aaeea 100644 --- a/pmc_common.c +++ b/pmc_common.c @@ -93,6 +93,10 @@ struct pmc *pmc_create(struct config *cfg, enum transport_type transport_type, } strncpy(iface.name, iface_name, MAX_IFNAME_SIZE); + if (iface.ts_label[0] == '\0') { + strncpy(iface.ts_label, iface.name, MAX_IFNAME_SIZE); + } + if (transport_open(pmc->transport, &iface, &pmc->fdarray, TS_SOFTWARE)) { pr_err("failed to open transport");