diff mbox series

[4.19,018/264] chelsio/chtls: correct function return and return type

Message ID 20201027135431.522408687@linuxfoundation.org
State Superseded
Headers show
Series None | expand

Commit Message

Greg KH Oct. 27, 2020, 1:51 p.m. UTC
From: Vinay Kumar Yadav <vinay.yadav@chelsio.com>

[ Upstream commit 8580a61aede28d441e1c80588803411ee86aa299 ]

csk_mem_free() should return true if send buffer is available,
false otherwise.

Fixes: 3b8305f5c844 ("crypto: chtls - wait for memory sendmsg, sendpage")
Signed-off-by: Vinay Kumar Yadav <vinay.yadav@chelsio.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/crypto/chelsio/chtls/chtls_io.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Pavel Machek Oct. 28, 2020, 6:58 a.m. UTC | #1
Hi!

> From: Vinay Kumar Yadav <vinay.yadav@chelsio.com>
> 
> [ Upstream commit 8580a61aede28d441e1c80588803411ee86aa299 ]
> 
> csk_mem_free() should return true if send buffer is available,
> false otherwise.

> Fixes: 3b8305f5c844 ("crypto: chtls - wait for memory sendmsg, sendpage")

This does not fix anything. In fact, binary code should be exactly
equivalent. It does not need to be in 4.19-stable.

Best regards,
								Pavel


> --- a/drivers/crypto/chelsio/chtls/chtls_io.c
> +++ b/drivers/crypto/chelsio/chtls/chtls_io.c
> @@ -914,9 +914,9 @@ static int tls_header_read(struct tls_hd
>  	return (__force int)cpu_to_be16(thdr->length);
>  }
>  
> -static int csk_mem_free(struct chtls_dev *cdev, struct sock *sk)
> +static bool csk_mem_free(struct chtls_dev *cdev, struct sock *sk)
>  {
> -	return (cdev->max_host_sndbuf - sk->sk_wmem_queued);
> +	return (cdev->max_host_sndbuf - sk->sk_wmem_queued > 0);
>  }
>  
>  static int csk_wait_memory(struct chtls_dev *cdev,
>
Jakub Kicinski Oct. 28, 2020, 4:46 p.m. UTC | #2
On Wed, 28 Oct 2020 07:58:04 +0100 Pavel Machek wrote:
> > From: Vinay Kumar Yadav <vinay.yadav@chelsio.com>
> > 
> > [ Upstream commit 8580a61aede28d441e1c80588803411ee86aa299 ]
> > 
> > csk_mem_free() should return true if send buffer is available,
> > false otherwise.  
> 
> > Fixes: 3b8305f5c844 ("crypto: chtls - wait for memory sendmsg, sendpage")  
> 
> This does not fix anything. In fact, binary code should be exactly
> equivalent. It does not need to be in 4.19-stable.

Not sure why you think binary code will be equivalent.

The condition changed from:

cdev->max_host_sndbuf != sk->sk_wmem_queued

to

cdev->max_host_sndbuf > sk->sk_wmem_queued


That said Chelsio would have to comment if it really fixes any real
user-visible issue :)

> > @@ -914,9 +914,9 @@ static int tls_header_read(struct tls_hd
> >  	return (__force int)cpu_to_be16(thdr->length);
> >  }
> >  
> > -static int csk_mem_free(struct chtls_dev *cdev, struct sock *sk)
> > +static bool csk_mem_free(struct chtls_dev *cdev, struct sock *sk)
> >  {
> > -	return (cdev->max_host_sndbuf - sk->sk_wmem_queued);
> > +	return (cdev->max_host_sndbuf - sk->sk_wmem_queued > 0);
> >  }
> >  
> >  static int csk_wait_memory(struct chtls_dev *cdev,
diff mbox series

Patch

--- a/drivers/crypto/chelsio/chtls/chtls_io.c
+++ b/drivers/crypto/chelsio/chtls/chtls_io.c
@@ -914,9 +914,9 @@  static int tls_header_read(struct tls_hd
 	return (__force int)cpu_to_be16(thdr->length);
 }
 
-static int csk_mem_free(struct chtls_dev *cdev, struct sock *sk)
+static bool csk_mem_free(struct chtls_dev *cdev, struct sock *sk)
 {
-	return (cdev->max_host_sndbuf - sk->sk_wmem_queued);
+	return (cdev->max_host_sndbuf - sk->sk_wmem_queued > 0);
 }
 
 static int csk_wait_memory(struct chtls_dev *cdev,