Skip to contentSkip to conversation

tls: rx: Fix unsigned comparison with less than zero

PATCH Applied Yang Li 2 participants 2 messages Jul 28, 2022 – Jul 29, 2022

Subsystems (3)
lore
Share & tools
lore

Yang Li

author
#0 lore raw

PATCH v2 1/1 tls: rx: Fix unsigned comparison with less than zero

The return from the call to tls_rx_msg_size() is int, it can be a negative error code, however this is being assigned to an unsigned long variable 'sz', so making 'sz' an int.

Eliminate the following coccicheck warning:
./net/tls/tls_strp.c:211:6-8: WARNING: Unsigned expression compared with zero: sz < 0

---

Changes in v2:
--According to Jakub's suggestion
Keep the sorting of the variable lines from longest to shortest.

 net/tls/tls_strp.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
net/tls/tls_strp.c +2 -1
index b945288c312e..841e721a8ec4 100644
@@ -187,9 +187,10 @@ static int tls_strp_copyin(read_descriptor_t *desc, struct sk_buff *in_skb,
 			   unsigned int offset, size_t in_len)
 {
 	struct tls_strparser *strp = (struct tls_strparser *)desc->arg.data;
-	size_t sz, len, chunk;
 	struct sk_buff *skb;
 	skb_frag_t *frag;
+	size_t len, chunk;
+	int sz;
 
 	if (strp->msg_ready)
 		return 0;
Signature · 1 line
2.20.1.7.g153144c
#1 lore raw
This patch was applied to netdev/net-next.git (master) by Jakub Kicinski <[email protected]>:

Hello:

This patch was applied to netdev/net-next.git (master) by Jakub Kicinski <[email protected]>:

Quoted 8 lines · On Thu, 28 Jul 2022 11:10:19 +0800 you wrote:

The return from the call to tls_rx_msg_size() is int, it can be a negative error code, however this is being assigned to an unsigned long variable 'sz', so making 'sz' an int.

Eliminate the following coccicheck warning:
./net/tls/tls_strp.c:211:6-8: WARNING: Unsigned expression compared with zero: sz < 0

[...]

Here is the summary with links:
- [-next,v2] tls: rx: Fix unsigned comparison with less than zero

    https://git.kernel.org/netdev/net-next/c/8fd1e1517792

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html