[1/5] net/fm10k: fix dereference after null check coverity

Message ID 1564952430-6585-1-git-send-email-xiao.zhang@intel.com (mailing list archive)
State Superseded, archived
Headers
Series [1/5] net/fm10k: fix dereference after null check coverity |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/iol-Compile-Testing success Compile Testing PASS
ci/Intel-compilation success Compilation OK
ci/intel-Performance-Testing success Performance Testing PASS
ci/mellanox-Performance-Testing success Performance Testing PASS

Commit Message

Xiao Zhang Aug. 4, 2019, 9 p.m. UTC
  The address of receive queue start segment was not updated when found by
iterated checking, update the address to fix coverity issue.

Coverity issue: 343416
Fixes: fe65e1e1 ("fm10k: add vector scatter Rx")

Cc: stable@dpdk.org

Signed-off-by: Xiao Zhang <xiao.zhang@intel.com>
---
 drivers/net/fm10k/fm10k_rxtx_vec.c | 1 +
 1 file changed, 1 insertion(+)
  

Comments

Xiaolong Ye Aug. 5, 2019, 3:35 a.m. UTC | #1
Hi, Xiao

It's better to have a cover letter for a patch series that contains more than
1 patches, where you can have an overall description of the patchset.

On 08/05, Xiao Zhang wrote:
>The address of receive queue start segment was not updated when found by
>iterated checking, update the address to fix coverity issue.

I suggest to describe more details (dereference after null check) about the
issue other than just say general coverity issue.

>
>Coverity issue: 343416
>Fixes: fe65e1e1 ("fm10k: add vector scatter Rx")
>
>Cc: stable@dpdk.org
>
>Signed-off-by: Xiao Zhang <xiao.zhang@intel.com>
>---
> drivers/net/fm10k/fm10k_rxtx_vec.c | 1 +
> 1 file changed, 1 insertion(+)
>
>diff --git a/drivers/net/fm10k/fm10k_rxtx_vec.c b/drivers/net/fm10k/fm10k_rxtx_vec.c
>index 788e248..9f2c4ac 100644
>--- a/drivers/net/fm10k/fm10k_rxtx_vec.c
>+++ b/drivers/net/fm10k/fm10k_rxtx_vec.c
>@@ -676,6 +676,7 @@ fm10k_recv_scattered_pkts_vec(void *rx_queue,
> 		/* find the first split flag, and only reassemble then*/
> 		while (i < nb_bufs && !split_flags[i])
> 			i++;
>+		rxq->pkt_first_seg = rx_pkts[i];

Minor nit, if i == nb_bufs, above assignment is  meaningless, suggest to move
it after i == nb_bufs check although it doesn't affect the functionality. 
I think it applies for the rest of patches too.

Thanks,
Xiaolong

> 		if (i == nb_bufs)
> 			return nb_bufs;
> 	}
>-- 
>2.7.4
>
  

Patch

diff --git a/drivers/net/fm10k/fm10k_rxtx_vec.c b/drivers/net/fm10k/fm10k_rxtx_vec.c
index 788e248..9f2c4ac 100644
--- a/drivers/net/fm10k/fm10k_rxtx_vec.c
+++ b/drivers/net/fm10k/fm10k_rxtx_vec.c
@@ -676,6 +676,7 @@  fm10k_recv_scattered_pkts_vec(void *rx_queue,
 		/* find the first split flag, and only reassemble then*/
 		while (i < nb_bufs && !split_flags[i])
 			i++;
+		rxq->pkt_first_seg = rx_pkts[i];
 		if (i == nb_bufs)
 			return nb_bufs;
 	}