Signed-off-by: Stuart Haslam <[email protected]>
---
platform/linux-generic/include/odp_packet_io_internal.h | 4 +++-
platform/linux-generic/odp_packet_io.c | 9 +++++----
2 files changed, 8 insertions(+), 5 deletions(-)
diff --git a/platform/linux-generic/include/odp_packet_io_internal.h
b/platform/linux-generic/include/odp_packet_io_internal.h
index a21c683..bdffc15 100644
--- a/platform/linux-generic/include/odp_packet_io_internal.h
+++ b/platform/linux-generic/include/odp_packet_io_internal.h
@@ -28,6 +28,8 @@ extern "C" {
#include <odp/hints.h>
#include <net/if.h>
+#define PKTIO_NAME_LEN 256
+
/* Forward declaration */
struct pktio_if_ops;
@@ -55,7 +57,7 @@ struct pktio_entry {
STATE_STOP
} state;
classifier_t cls; /**< classifier linked with this pktio*/
- char name[IF_NAMESIZE]; /**< name of pktio provided to
+ char name[PKTIO_NAME_LEN]; /**< name of pktio provided to
pktio_open() */
odp_pktio_param_t param;
};
diff --git a/platform/linux-generic/odp_packet_io.c
b/platform/linux-generic/odp_packet_io.c
index 4e07766..5d15ff0 100644
--- a/platform/linux-generic/odp_packet_io.c
+++ b/platform/linux-generic/odp_packet_io.c
@@ -204,10 +204,10 @@ static odp_pktio_t setup_pktio_entry(const char *dev,
odp_pool_t pool,
int ret = -1;
int pktio_if;
- if (strlen(dev) >= IF_NAMESIZE) {
+ if (strlen(dev) >= PKTIO_NAME_LEN - 1) {
/* ioctl names limitation */
ODP_ERR("pktio name %s is too big, limit is %d bytes\n",
- dev, IF_NAMESIZE);
+ dev, PKTIO_NAME_LEN - 1);
return ODP_PKTIO_INVALID;
}
@@ -239,7 +239,8 @@ static odp_pktio_t setup_pktio_entry(const char *dev,
odp_pool_t pool,
id = ODP_PKTIO_INVALID;
ODP_ERR("Unable to init any I/O type.\n");
} else {
- snprintf(pktio_entry->s.name, IF_NAMESIZE, "%s", dev);
+ snprintf(pktio_entry->s.name,
+ sizeof(pktio_entry->s.name), "%s", dev);
unlock_entry_classifier(pktio_entry);
}
@@ -339,7 +340,7 @@ odp_pktio_t odp_pktio_lookup(const char *dev)
lock_entry(entry);
if (!is_free(entry) &&
- strncmp(entry->s.name, dev, IF_NAMESIZE) == 0)
+ strncmp(entry->s.name, dev, sizeof(entry->s.name)) == 0)
id = _odp_cast_scalar(odp_pktio_t, i);
unlock_entry(entry);
--
2.1.1
_______________________________________________
lng-odp mailing list
[email protected]
https://lists.linaro.org/mailman/listinfo/lng-odp