diff mbox

linux-gen: pktio: fix variable overwrite in pktin_recv_buf

Message ID 1465449893-17912-1-git-send-email-matias.elo@nokia.com
State Accepted
Commit 1d0d1a1e1b98ebbe2c6dbdb1aae23a704c1dac47
Headers show

Commit Message

Elo, Matias (Nokia - FI/Espoo) June 9, 2016, 5:24 a.m. UTC
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(-)

Comments

Maxim Uvarov June 9, 2016, 6:28 a.m. UTC | #1
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);
Maxim Uvarov June 10, 2016, 8:55 a.m. UTC | #2
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);
Maxim Uvarov June 10, 2016, 9:26 a.m. UTC | #3
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 mbox

Patch

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);