Skip to content

Commit

Permalink
tests/tcp: Initialize buffer to NULL
Browse files Browse the repository at this point in the history
This commit initializes some net_buf variables to NULL to solve the
issue reported by Coverity: "Memory illegal accesses (UNINIT)".

Coverity-CID: 157610
Coverity-CID: 157611
Coverity-CID: 157612
Coverity-CID: 157617
Coverity-CID: 157619
Coverity-CID: 157620
Coverity-CID: 157622
Coverity-CID: 157624
Coverity-CID: 157626
Coverity-CID: 157627
Coverity-CID: 157628

Change-Id: I98a1ea5db4c169f69e3fa3d5de4c0ed7fdf1820a
Signed-off-by: Flavio Santes <[email protected]>
  • Loading branch information
1010101001010101 authored and Tomasz Bursztyka committed Dec 16, 2016
1 parent fc24fc2 commit a73a5bc
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions tests/net/tcp/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ static void net_tcp_iface_init(struct net_if *iface)

static void v6_send_syn_ack(struct net_if *iface, struct net_buf *req)
{
struct net_buf *rsp;
struct net_buf *rsp = NULL;
int ret;

ret = net_tcp_prepare_segment(reply_v6_ctx->tcp,
Expand Down Expand Up @@ -765,7 +765,7 @@ static bool test_create_v6_reset_packet(void)
{
struct net_tcp *tcp = v6_ctx->tcp;
uint8_t flags = NET_TCP_RST;
struct net_buf *buf;
struct net_buf *buf = NULL;
int ret;

ret = net_tcp_prepare_segment(tcp, flags, NULL, 0,
Expand Down Expand Up @@ -794,9 +794,9 @@ static bool test_create_v6_reset_packet(void)

static bool test_create_v4_reset_packet(void)
{
struct net_buf *buf;
struct net_tcp *tcp = v4_ctx->tcp;
uint8_t flags = NET_TCP_RST;
struct net_buf *buf = NULL;
int ret;

ret = net_tcp_prepare_segment(tcp, flags, NULL, 0,
Expand Down Expand Up @@ -825,9 +825,9 @@ static bool test_create_v4_reset_packet(void)

static bool test_create_v6_syn_packet(void)
{
struct net_buf *buf;
struct net_tcp *tcp = v6_ctx->tcp;
uint8_t flags = NET_TCP_SYN;
struct net_buf *buf = NULL;
int ret;

ret = net_tcp_prepare_segment(tcp, flags, NULL, 0,
Expand Down Expand Up @@ -856,9 +856,9 @@ static bool test_create_v6_syn_packet(void)

static bool test_create_v4_syn_packet(void)
{
struct net_buf *buf;
struct net_tcp *tcp = v4_ctx->tcp;
uint8_t flags = NET_TCP_SYN;
struct net_buf *buf = NULL;
int ret;

ret = net_tcp_prepare_segment(tcp, flags, NULL, 0,
Expand Down Expand Up @@ -887,9 +887,9 @@ static bool test_create_v4_syn_packet(void)

static bool test_create_v6_synack_packet(void)
{
struct net_buf *buf;
struct net_tcp *tcp = v6_ctx->tcp;
uint8_t flags = NET_TCP_SYN | NET_TCP_ACK;
struct net_buf *buf = NULL;
int ret;

ret = net_tcp_prepare_segment(tcp, flags, NULL, 0,
Expand Down Expand Up @@ -919,9 +919,9 @@ static bool test_create_v6_synack_packet(void)

static bool test_create_v4_synack_packet(void)
{
struct net_buf *buf;
struct net_tcp *tcp = v4_ctx->tcp;
uint8_t flags = NET_TCP_SYN | NET_TCP_ACK;
struct net_buf *buf = NULL;
int ret;

ret = net_tcp_prepare_segment(tcp, flags, NULL, 0,
Expand Down Expand Up @@ -951,9 +951,9 @@ static bool test_create_v4_synack_packet(void)

static bool test_create_v6_fin_packet(void)
{
struct net_buf *buf;
struct net_tcp *tcp = v6_ctx->tcp;
uint8_t flags = NET_TCP_FIN;
struct net_buf *buf = NULL;
int ret;

ret = net_tcp_prepare_segment(tcp, flags, NULL, 0,
Expand Down Expand Up @@ -982,9 +982,9 @@ static bool test_create_v6_fin_packet(void)

static bool test_create_v4_fin_packet(void)
{
struct net_buf *buf;
struct net_tcp *tcp = v4_ctx->tcp;
uint8_t flags = NET_TCP_FIN;
struct net_buf *buf = NULL;
int ret;

ret = net_tcp_prepare_segment(tcp, flags, NULL, 0,
Expand Down Expand Up @@ -1013,9 +1013,9 @@ static bool test_create_v4_fin_packet(void)

static bool test_v6_seq_check(void)
{
struct net_buf *buf;
struct net_tcp *tcp = v6_ctx->tcp;
uint8_t flags = NET_TCP_SYN;
struct net_buf *buf = NULL;
uint32_t seq;
int ret;

Expand Down Expand Up @@ -1045,9 +1045,9 @@ static bool test_v6_seq_check(void)

static bool test_v4_seq_check(void)
{
struct net_buf *buf;
struct net_tcp *tcp = v4_ctx->tcp;
uint8_t flags = NET_TCP_SYN;
struct net_buf *buf = NULL;
uint32_t seq;
int ret;

Expand Down

0 comments on commit a73a5bc

Please sign in to comment.