[API-NEXT,v3,1/2] linux-gen: chksum: correct uninitialized variable bug

Message ID 1507536007-26802-2-git-send-email-odpbot@yandex.ru
State New
Headers show
Series
  • Long UDP packet checksum test
Related show

Commit Message

Github ODP bot Oct. 9, 2017, 8 a.m.
From: Petri Savolainen <petri.savolainen@linaro.org>


Initialize left_over variable, so that the pad byte
is initialized to zero.

Signed-off-by: Petri Savolainen <petri.savolainen@linaro.org>

---
/** Email created from pull request 224 (psavol:next-ip-checksum)
 ** https://github.com/Linaro/odp/pull/224
 ** Patch: https://github.com/Linaro/odp/pull/224.patch
 ** Base sha: bf803098eb1518dfb9e719071256fe22700b8c72
 ** Merge commit sha: 947cdf84dbec4659ea3c2059299e6a60d314e438
 **/
 platform/linux-generic/odp_chksum.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Patch

diff --git a/platform/linux-generic/odp_chksum.c b/platform/linux-generic/odp_chksum.c
index 349bdaf46..a792971ef 100644
--- a/platform/linux-generic/odp_chksum.c
+++ b/platform/linux-generic/odp_chksum.c
@@ -22,7 +22,7 @@  uint16_t odp_chksum_ones_comp16(const void *p, uint32_t len)
 
 	/* Add left-over byte, if any */
 	if (len > 0) {
-		uint16_t left_over;
+		uint16_t left_over = 0;
 
 		*(uint8_t *)&left_over = *(const uint8_t *)data;
 		sum += left_over;