Skip to content

Commit

Permalink
tls: rx: Fix unsigned comparison with less than zero
Browse files Browse the repository at this point in the history
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>
Link: https://lore.kernel.org/r/20220728031019.32838-1-yang.lee@linux.alibaba.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
  • Loading branch information
Yang Li authored and Jakub Kicinski committed Jul 29, 2022
1 parent 37e2618 commit 8fd1e15
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion net/tls/tls_strp.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 8fd1e15

Please sign in to comment.