diff mbox series

selftests/tls: Add {} to avoid static checker warning

Message ID 20210527032718.3730773-1-keescook@chromium.org
State Accepted
Commit f50688b47c5858d2ff315d020332bf4cb6710837
Headers show
Series selftests/tls: Add {} to avoid static checker warning | expand

Commit Message

Kees Cook May 27, 2021, 3:27 a.m. UTC
This silences a static checker warning due to the unusual macro
construction of EXPECT_*() by adding explicit {}s around the enclosing
while loop.

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Fixes: 7f657d5bf507 ("selftests: tls: add selftests for TLS sockets")
Signed-off-by: Kees Cook <keescook@chromium.org>
---
 tools/testing/selftests/net/tls.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Shuah Khan June 4, 2021, 9:34 p.m. UTC | #1
On 5/26/21 9:27 PM, Kees Cook wrote:
> This silences a static checker warning due to the unusual macro

> construction of EXPECT_*() by adding explicit {}s around the enclosing

> while loop.

> 

> Reported-by: Dan Carpenter <dan.carpenter@oracle.com>

> Fixes: 7f657d5bf507 ("selftests: tls: add selftests for TLS sockets")

> Signed-off-by: Kees Cook <keescook@chromium.org>

> ---

>   tools/testing/selftests/net/tls.c | 3 ++-

>   1 file changed, 2 insertions(+), 1 deletion(-)

> 

> diff --git a/tools/testing/selftests/net/tls.c b/tools/testing/selftests/net/tls.c

> index 426d07875a48..7119f8eb823b 100644

> --- a/tools/testing/selftests/net/tls.c

> +++ b/tools/testing/selftests/net/tls.c

> @@ -418,8 +418,9 @@ TEST_F(tls, sendmsg_large)

>   		EXPECT_EQ(sendmsg(self->cfd, &msg, 0), send_len);

>   	}

>   

> -	while (recvs++ < sends)

> +	while (recvs++ < sends) {

>   		EXPECT_NE(recv(self->fd, mem, send_len, 0), -1);

> +	}

>   

>   	free(mem);

>   }

> 


Will pick this up for 5.14

thanks,
-- Shuah
diff mbox series

Patch

diff --git a/tools/testing/selftests/net/tls.c b/tools/testing/selftests/net/tls.c
index 426d07875a48..7119f8eb823b 100644
--- a/tools/testing/selftests/net/tls.c
+++ b/tools/testing/selftests/net/tls.c
@@ -418,8 +418,9 @@  TEST_F(tls, sendmsg_large)
 		EXPECT_EQ(sendmsg(self->cfd, &msg, 0), send_len);
 	}
 
-	while (recvs++ < sends)
+	while (recvs++ < sends) {
 		EXPECT_NE(recv(self->fd, mem, send_len, 0), -1);
+	}
 
 	free(mem);
 }