tls: rx: Fix unsigned comparison with less than zero
Subsystems (3)
PATCH 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
Reported-by Abaci Robot <[email protected]>
Signed-off-by Yang Li <[email protected]>
--- net/tls/tls_strp.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
net/tls/tls_strp.c +2 -1
@@ -187,7 +187,8 @@ 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; +int sz; +size_t len, chunk;struct sk_buff *skb;skb_frag_t *frag;
Signature · 1 line
2.20.1.7.g153144c
Jakub Kicinski
maintainernet/tls/tls_strp.c static int tls_strp_copyin(read_descriptor_t *desc, struct sk_buff *in_skb, · line 193
Quoted 6 lines · On Thu, 28 Jul 2022 09:10:25 +0800 Yang Li wrote:
net/tls/tls_strp.c +2
-1struct tls_strparser *strp = (struct tls_strparser *)desc->arg.data; -size_t sz, len, chunk; +int sz; +size_t len, chunk;struct sk_buff *skb;skb_frag_t *frag;
Thanks for the fix, please keep the sorting of the variable lines from longest to shortest. "int sz;" should be the last variable declaration line and "size_t len, chunk;" goes after the skb.