diff mbox series

[-next,v2] tls: rx: Fix unsigned comparison with less than zero

Message ID 20220728031019.32838-1-yang.lee@linux.alibaba.com (mailing list archive)
State Accepted
Commit 8fd1e151779285b211e7184e9237bba69bd74386
Delegated to: Netdev Maintainers
Headers show
Series [-next,v2] tls: rx: Fix unsigned comparison with less than zero | expand

Checks

Context Check Description
netdev/tree_selection success Guessed tree name to be net-next
netdev/fixes_present success Fixes tag not required for -next series
netdev/subject_prefix warning Target tree name not specified in the subject
netdev/cover_letter success Single patches do not need cover letters
netdev/patch_count success Link
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 0 this patch: 0
netdev/cc_maintainers success CCed 7 of 7 maintainers
netdev/build_clang success Errors and warnings before: 0 this patch: 0
netdev/module_param success Was 0 now: 0
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 0 this patch: 0
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 11 lines checked
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Yang Li July 28, 2022, 3:10 a.m. UTC
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(-)

Comments

patchwork-bot+netdevbpf@kernel.org July 29, 2022, 5 a.m. UTC | #1
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!
diff mbox series

Patch

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;