* [PATCH][next] tls: rx: Fix less than zero check on unsigned variable sz
@ 2022-07-30 11:40 Colin Ian King
2022-08-01 19:24 ` Jakub Kicinski
0 siblings, 1 reply; 2+ messages in thread
From: Colin Ian King @ 2022-07-30 11:40 UTC (permalink / raw)
To: Boris Pismenny, John Fastabend, Jakub Kicinski, David S . Miller,
Eric Dumazet, Paolo Abeni, netdev
Cc: kernel-janitors, linux-kernel
Variable sz is declared as an unsigned size_t and is being checked
for an less than zero error return on a call to tls_rx_msg_size.
Fix this by making sz an int.
Fixes: 84c61fe1a75b ("tls: rx: do not use the standard strparser")
Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
---
net/tls/tls_strp.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/net/tls/tls_strp.c b/net/tls/tls_strp.c
index b945288c312e..2b9c42b8064c 100644
--- a/net/tls/tls_strp.c
+++ b/net/tls/tls_strp.c
@@ -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;
@@ -215,7 +216,7 @@ static int tls_strp_copyin(read_descriptor_t *desc, struct sk_buff *in_skb,
/* We may have over-read, sz == 0 is guaranteed under-read */
if (sz > 0)
- chunk = min_t(size_t, chunk, sz - skb->len);
+ chunk = min_t(size_t, chunk, (size_t)sz - skb->len);
skb->len += chunk;
skb->data_len += chunk;
--
2.35.3
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH][next] tls: rx: Fix less than zero check on unsigned variable sz
2022-07-30 11:40 [PATCH][next] tls: rx: Fix less than zero check on unsigned variable sz Colin Ian King
@ 2022-08-01 19:24 ` Jakub Kicinski
0 siblings, 0 replies; 2+ messages in thread
From: Jakub Kicinski @ 2022-08-01 19:24 UTC (permalink / raw)
To: Colin Ian King
Cc: Boris Pismenny, John Fastabend, David S . Miller, Eric Dumazet,
Paolo Abeni, netdev, kernel-janitors, linux-kernel
On Sat, 30 Jul 2022 12:40:27 +0100 Colin Ian King wrote:
> Variable sz is declared as an unsigned size_t and is being checked
> for an less than zero error return on a call to tls_rx_msg_size.
> Fix this by making sz an int.
>
> Fixes: 84c61fe1a75b ("tls: rx: do not use the standard strparser")
> Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
> ---
> net/tls/tls_strp.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
Already fixed 2 days before you posted, I guess linux-next lagged.
commit 8fd1e151779285b211e7184e9237bba69bd74386
Author: Yang Li <yang.lee@linux.alibaba.com>
AuthorDate: Wed Jul 27 20:10:19 2022
Commit: Jakub Kicinski <kuba@kernel.org>
CommitDate: Thu Jul 28 21:50:39 2022
tls: rx: Fix unsigned comparison with less than zero
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-08-01 19:25 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-07-30 11:40 [PATCH][next] tls: rx: Fix less than zero check on unsigned variable sz Colin Ian King
2022-08-01 19:24 ` Jakub Kicinski
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).