netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH -next v2] tls: rx: Fix unsigned comparison with less than zero
@ 2022-07-28  3:10 Yang Li
  2022-07-29  5:00 ` patchwork-bot+netdevbpf
  0 siblings, 1 reply; 2+ messages in thread
From: Yang Li @ 2022-07-28  3:10 UTC (permalink / raw)
  To: kuba
  Cc: borisp, john.fastabend, davem, edumazet, pabeni, netdev,
	linux-kernel, Yang Li, Abaci Robot

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

Reported-by: Abaci Robot <abaci@linux.alibaba.com>
Signed-off-by: Yang Li <yang.lee@linux.alibaba.com>
---

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(-)

diff --git a/net/tls/tls_strp.c b/net/tls/tls_strp.c
index b945288c312e..841e721a8ec4 100644
--- a/net/tls/tls_strp.c
+++ b/net/tls/tls_strp.c
@@ -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;
-- 
2.20.1.7.g153144c


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH -next v2] tls: rx: Fix unsigned comparison with less than zero
  2022-07-28  3:10 [PATCH -next v2] tls: rx: Fix unsigned comparison with less than zero Yang Li
@ 2022-07-29  5:00 ` patchwork-bot+netdevbpf
  0 siblings, 0 replies; 2+ messages in thread
From: patchwork-bot+netdevbpf @ 2022-07-29  5:00 UTC (permalink / raw)
  To: Yang Li
  Cc: kuba, borisp, john.fastabend, davem, edumazet, pabeni, netdev,
	linux-kernel, abaci

Hello:

This patch was applied to netdev/net-next.git (master)
by Jakub Kicinski <kuba@kernel.org>:

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!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-07-29  5:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-28  3:10 [PATCH -next v2] tls: rx: Fix unsigned comparison with less than zero Yang Li
2022-07-29  5:00 ` patchwork-bot+netdevbpf

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).