Message ID | 1465449893-17912-1-git-send-email-matias.elo@nokia.com |
---|---|
State | Accepted |
Commit | 1d0d1a1e1b98ebbe2c6dbdb1aae23a704c1dac47 |
Headers | show |
uh... good fix, thanks :) On 06/09/16 08:24, Matias Elo wrote: > Fix variable overwrite bug in pktin_recv_buf(). > > Signed-off-by: Matias Elo <matias.elo@nokia.com> > --- > platform/linux-generic/odp_packet_io.c | 7 ++++--- > 1 file changed, 4 insertions(+), 3 deletions(-) > > diff --git a/platform/linux-generic/odp_packet_io.c b/platform/linux-generic/odp_packet_io.c > index 6de39b6..416a361 100644 > --- a/platform/linux-generic/odp_packet_io.c > +++ b/platform/linux-generic/odp_packet_io.c > @@ -540,12 +540,12 @@ static inline int pktin_recv_buf(odp_pktin_queue_t queue, > odp_buffer_hdr_t *buf_hdr; > odp_buffer_t buf; > int i; > - int ret; > + int pkts; > int num_rx = 0; > > - ret = odp_pktin_recv(queue, packets, num); > + pkts = odp_pktin_recv(queue, packets, num); > > - for (i = 0; i < ret; i++) { > + for (i = 0; i < pkts; i++) { > pkt = packets[i]; > pkt_hdr = odp_packet_hdr(pkt); > buf = _odp_packet_to_buffer(pkt); > @@ -553,6 +553,7 @@ static inline int pktin_recv_buf(odp_pktin_queue_t queue, > > if (pkt_hdr->input_flags.dst_queue) { > queue_entry_t *dst_queue; > + int ret; > > dst_queue = queue_to_qentry(pkt_hdr->dst_queue); > ret = queue_enq(dst_queue, buf_hdr, 0);
Merged, Maxim. On 06/09/16 08:24, Matias Elo wrote: > Fix variable overwrite bug in pktin_recv_buf(). > > Signed-off-by: Matias Elo <matias.elo@nokia.com> > --- > platform/linux-generic/odp_packet_io.c | 7 ++++--- > 1 file changed, 4 insertions(+), 3 deletions(-) > > diff --git a/platform/linux-generic/odp_packet_io.c b/platform/linux-generic/odp_packet_io.c > index 6de39b6..416a361 100644 > --- a/platform/linux-generic/odp_packet_io.c > +++ b/platform/linux-generic/odp_packet_io.c > @@ -540,12 +540,12 @@ static inline int pktin_recv_buf(odp_pktin_queue_t queue, > odp_buffer_hdr_t *buf_hdr; > odp_buffer_t buf; > int i; > - int ret; > + int pkts; > int num_rx = 0; > > - ret = odp_pktin_recv(queue, packets, num); > + pkts = odp_pktin_recv(queue, packets, num); > > - for (i = 0; i < ret; i++) { > + for (i = 0; i < pkts; i++) { > pkt = packets[i]; > pkt_hdr = odp_packet_hdr(pkt); > buf = _odp_packet_to_buffer(pkt); > @@ -553,6 +553,7 @@ static inline int pktin_recv_buf(odp_pktin_queue_t queue, > > if (pkt_hdr->input_flags.dst_queue) { > queue_entry_t *dst_queue; > + int ret; > > dst_queue = queue_to_qentry(pkt_hdr->dst_queue); > ret = queue_enq(dst_queue, buf_hdr, 0);
Merged, Maxim. On 06/09/16 08:24, Matias Elo wrote: > Fix variable overwrite bug in pktin_recv_buf(). > > Signed-off-by: Matias Elo <matias.elo@nokia.com> > --- > platform/linux-generic/odp_packet_io.c | 7 ++++--- > 1 file changed, 4 insertions(+), 3 deletions(-) > > diff --git a/platform/linux-generic/odp_packet_io.c b/platform/linux-generic/odp_packet_io.c > index 6de39b6..416a361 100644 > --- a/platform/linux-generic/odp_packet_io.c > +++ b/platform/linux-generic/odp_packet_io.c > @@ -540,12 +540,12 @@ static inline int pktin_recv_buf(odp_pktin_queue_t queue, > odp_buffer_hdr_t *buf_hdr; > odp_buffer_t buf; > int i; > - int ret; > + int pkts; > int num_rx = 0; > > - ret = odp_pktin_recv(queue, packets, num); > + pkts = odp_pktin_recv(queue, packets, num); > > - for (i = 0; i < ret; i++) { > + for (i = 0; i < pkts; i++) { > pkt = packets[i]; > pkt_hdr = odp_packet_hdr(pkt); > buf = _odp_packet_to_buffer(pkt); > @@ -553,6 +553,7 @@ static inline int pktin_recv_buf(odp_pktin_queue_t queue, > > if (pkt_hdr->input_flags.dst_queue) { > queue_entry_t *dst_queue; > + int ret; > > dst_queue = queue_to_qentry(pkt_hdr->dst_queue); > ret = queue_enq(dst_queue, buf_hdr, 0);
diff --git a/platform/linux-generic/odp_packet_io.c b/platform/linux-generic/odp_packet_io.c index 6de39b6..416a361 100644 --- a/platform/linux-generic/odp_packet_io.c +++ b/platform/linux-generic/odp_packet_io.c @@ -540,12 +540,12 @@ static inline int pktin_recv_buf(odp_pktin_queue_t queue, odp_buffer_hdr_t *buf_hdr; odp_buffer_t buf; int i; - int ret; + int pkts; int num_rx = 0; - ret = odp_pktin_recv(queue, packets, num); + pkts = odp_pktin_recv(queue, packets, num); - for (i = 0; i < ret; i++) { + for (i = 0; i < pkts; i++) { pkt = packets[i]; pkt_hdr = odp_packet_hdr(pkt); buf = _odp_packet_to_buffer(pkt); @@ -553,6 +553,7 @@ static inline int pktin_recv_buf(odp_pktin_queue_t queue, if (pkt_hdr->input_flags.dst_queue) { queue_entry_t *dst_queue; + int ret; dst_queue = queue_to_qentry(pkt_hdr->dst_queue); ret = queue_enq(dst_queue, buf_hdr, 0);
Fix variable overwrite bug in pktin_recv_buf(). Signed-off-by: Matias Elo <matias.elo@nokia.com> --- platform/linux-generic/odp_packet_io.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)