[PATCH ustream-ssl 06/12] ustream-mbedtls: fix comparison of integers of different signs

Petr Štetiar ynezz at true.cz
Thu Dec 10 10:41:28 EST 2020


Fixes following compiler extra warning:

 ustream-mbedtls.c:40:11: error: comparison of integers of different signs: 'int' and 'size_t' (aka 'unsigned long') [-Werror,-Wsign-compare]
        if (slen > len)
            ~~~~ ^ ~~~

Signed-off-by: Petr Štetiar <ynezz at true.cz>
---
 ustream-mbedtls.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/ustream-mbedtls.c b/ustream-mbedtls.c
index 9f73c5836034..3424743c6452 100644
--- a/ustream-mbedtls.c
+++ b/ustream-mbedtls.c
@@ -37,7 +37,7 @@ static int s_ustream_read(void *ctx, unsigned char *buf, size_t len)
 		return 0;
 
 	sbuf = ustream_get_read_buf(s, &slen);
-	if (slen > len)
+	if ((size_t) slen > len)
 		slen = len;
 
 	if (!slen)



More information about the openwrt-devel mailing list