Message ID | 1441372829-12886-2-git-send-email-stuart.haslam@linaro.org |
---|---|
State | New |
Headers | show |
This one won't apply on master anymore: Applying: linux-generic: pktio: extend maximum devname length error: patch failed: platform/linux-generic/odp_packet_io.c:239 error: platform/linux-generic/odp_packet_io.c: patch does not apply Patch failed at 0001 linux-generic: pktio: extend maximum devname length On 09/04/2015 03:20 PM, Stuart Haslam wrote: > Signed-off-by: Stuart Haslam <stuart.haslam@linaro.org> > --- > 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);
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);
Signed-off-by: Stuart Haslam <stuart.haslam@linaro.org> --- 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(-)