rdma: fix for-loop initialization in scalar path 20/37720/7
authorJieqiang Wang <jieqiang.wang@arm.com>
Fri, 25 Nov 2022 07:26:55 +0000 (15:26 +0800)
committerBeno�t Ganne <bganne@cisco.com>
Tue, 29 Nov 2022 12:58:51 +0000 (12:58 +0000)
commit6db2758611dd5f1cf82c0bf78cfb95230ed2786f
treee150ae122bf34db9ae17231c5a74a831fdc1e582
parent520cde406797eb076591797fbf9978b959e6cf17
rdma: fix for-loop initialization in scalar path

When n_rx_packets is less then 16(VEC256) or 8(VEC128), code execution
will fall into scalar path of processing packets. But with a wrong
initialization value for n_left set to zero, i in the for-loop will
equal to n_rx_packets. This leads to the bypass of required ip4 checksum
validation and byte count endianness conversion in scalar path.
Besides, refactor the code using while instead of for-loop to keep
consistency with VPP code style.

Type: fix
Fixes: bf93670c515d ("rdma: fix ipv4 checksum check in rdma-input node")

Signed-off-by: Lijian Zhang <lijian.zhang@arm.com>
Signed-off-by: Jieqiang Wang <jieqiang.wang@arm.com>
Change-Id: Ib4e8cb5202735f8b060c99caddf26035657551e1
src/plugins/rdma/input.c