linux-sctp.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Xin Long <lucien.xin@gmail.com>
To: linux-sctp@vger.kernel.org
Subject: [PATCH lksctp-tools 9/9] func_tests: fix covscan warnings
Date: Tue, 31 Jul 2018 08:53:17 +0000	[thread overview]
Message-ID: <565317fe15ba3a6e65ee1ffd850b5669613f16ee.1533027042.git.lucien.xin@gmail.com> (raw)

use the right socket parameter when calling test_sendto in
func_tests/test_1_to_1_sendto; and use 48, the ascii code
of '0', when calling memset in func_tests/test_timetolive,
since memset requires 'int' type.

Signed-off-by: Xin Long <lucien.xin@gmail.com>
---
 src/func_tests/test_1_to_1_rtoinfo.c   | 1 +
 src/func_tests/test_1_to_1_sendto.c    | 2 +-
 src/func_tests/test_sctp_sendrecvmsg.c | 2 +-
 src/func_tests/test_timetolive.c       | 2 +-
 4 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/func_tests/test_1_to_1_rtoinfo.c b/src/func_tests/test_1_to_1_rtoinfo.c
index 02dd477..1651df1 100644
--- a/src/func_tests/test_1_to_1_rtoinfo.c
+++ b/src/func_tests/test_1_to_1_rtoinfo.c
@@ -82,6 +82,7 @@ main(void)
 	srtoinfo.srto_initial`;
 	srtoinfo.srto_max\x100;
 	srtoinfo.srto_min@;
+	srtoinfo.srto_assoc_id = 0;
 
 	/*TEST2 Setting the values using setsockopt()*/
 	ret = setsockopt(sd, IPPROTO_SCTP, SCTP_RTOINFO, &srtoinfo, 
diff --git a/src/func_tests/test_1_to_1_sendto.c b/src/func_tests/test_1_to_1_sendto.c
index 8f5804c..56b102a 100644
--- a/src/func_tests/test_1_to_1_sendto.c
+++ b/src/func_tests/test_1_to_1_sendto.c
@@ -150,7 +150,7 @@ main(int argc, char *argv[])
 
 	/*send() TEST4: Sending less number of data from the buffer*/
 	/*Sending only 5 bytes so that only hello is received*/
-	test_sendto(sk, message, 5 , flag, (const struct sockaddr *)&conn_addr,
+	test_sendto(sk1, message, 5, flag, (const struct sockaddr *)&conn_addr,
 		    len);
 	test_recv(acpt_sk, message_rcv, 5, flag);
 	
diff --git a/src/func_tests/test_sctp_sendrecvmsg.c b/src/func_tests/test_sctp_sendrecvmsg.c
index 33d013c..ceccd5a 100644
--- a/src/func_tests/test_sctp_sendrecvmsg.c
+++ b/src/func_tests/test_sctp_sendrecvmsg.c
@@ -248,7 +248,7 @@ int main(int argc, char *argv[])
 	tst_resm(TPASS, "sctp_sendmsg with zero ttl");
 
 	/* And finally a fragmented message that will time out. */
-	memset(ttlfrag, '0', sizeof(ttlfrag));
+	memset(ttlfrag, 48, sizeof(ttlfrag)); /* 48 is the ascii of '0' */
 	ttlfrag[sizeof(ttlfrag)-1] = '\0';
 	test_sctp_sendmsg(sk1, ttlfrag, sizeof(ttlfrag),
 			  (struct sockaddr *)&loop2, sizeof(loop2),
diff --git a/src/func_tests/test_timetolive.c b/src/func_tests/test_timetolive.c
index 85325da..58d76f0 100644
--- a/src/func_tests/test_timetolive.c
+++ b/src/func_tests/test_timetolive.c
@@ -310,7 +310,7 @@ int main(int argc, char *argv[])
 	/* And finally a fragmented message that will time out. */
 	sinfo->sinfo_ppid = ppid;
 	sinfo->sinfo_stream = stream;
-	memset(ttlfrag, '0', sizeof(ttlfrag));
+	memset(ttlfrag, 48, sizeof(ttlfrag)); /* 48 is the ascii of '0' */
 	ttlfrag[sizeof(ttlfrag)-1] = '\0';
 	outmessage.msg_iov->iov_base = ttlfrag;
         outmessage.msg_iov->iov_len = sizeof(ttlfrag);
-- 
2.1.0


                 reply	other threads:[~2018-07-31  8:53 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=565317fe15ba3a6e65ee1ffd850b5669613f16ee.1533027042.git.lucien.xin@gmail.com \
    --to=lucien.xin@gmail.com \
    --cc=linux-sctp@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).