* [PATCH] crypto: chtls - use 'skb_put_zero()' instead of re-implementing it
@ 2019-08-07 15:40 Christophe JAILLET
2019-08-15 5:00 ` Herbert Xu
0 siblings, 1 reply; 2+ messages in thread
From: Christophe JAILLET @ 2019-08-07 15:40 UTC (permalink / raw)
To: atul.gupta, herbert, zhongjiang, ganeshgr, davem, tglx, bigeasy
Cc: linux-crypto, linux-kernel, kernel-janitors, Christophe JAILLET
'skb_put()+memset()' is equivalent to 'skb_put_zero()'
Use the latter because it is less verbose and it hides the internals of the
sk_buff structure.
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
drivers/crypto/chelsio/chtls/chtls_main.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/crypto/chelsio/chtls/chtls_main.c b/drivers/crypto/chelsio/chtls/chtls_main.c
index 635bb4b447fb..830b238da77e 100644
--- a/drivers/crypto/chelsio/chtls/chtls_main.c
+++ b/drivers/crypto/chelsio/chtls/chtls_main.c
@@ -218,9 +218,8 @@ static int chtls_get_skb(struct chtls_dev *cdev)
if (!cdev->askb)
return -ENOMEM;
- skb_put(cdev->askb, sizeof(struct tcphdr));
+ skb_put_zero(cdev->askb, sizeof(struct tcphdr));
skb_reset_transport_header(cdev->askb);
- memset(cdev->askb->data, 0, cdev->askb->len);
return 0;
}
--
2.20.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] crypto: chtls - use 'skb_put_zero()' instead of re-implementing it
2019-08-07 15:40 [PATCH] crypto: chtls - use 'skb_put_zero()' instead of re-implementing it Christophe JAILLET
@ 2019-08-15 5:00 ` Herbert Xu
0 siblings, 0 replies; 2+ messages in thread
From: Herbert Xu @ 2019-08-15 5:00 UTC (permalink / raw)
To: Christophe JAILLET
Cc: atul.gupta, zhongjiang, ganeshgr, davem, tglx, bigeasy,
linux-crypto, linux-kernel, kernel-janitors
On Wed, Aug 07, 2019 at 05:40:14PM +0200, Christophe JAILLET wrote:
> 'skb_put()+memset()' is equivalent to 'skb_put_zero()'
> Use the latter because it is less verbose and it hides the internals of the
> sk_buff structure.
>
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> ---
> drivers/crypto/chelsio/chtls/chtls_main.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/drivers/crypto/chelsio/chtls/chtls_main.c b/drivers/crypto/chelsio/chtls/chtls_main.c
> index 635bb4b447fb..830b238da77e 100644
> --- a/drivers/crypto/chelsio/chtls/chtls_main.c
> +++ b/drivers/crypto/chelsio/chtls/chtls_main.c
> @@ -218,9 +218,8 @@ static int chtls_get_skb(struct chtls_dev *cdev)
> if (!cdev->askb)
> return -ENOMEM;
>
> - skb_put(cdev->askb, sizeof(struct tcphdr));
> + skb_put_zero(cdev->askb, sizeof(struct tcphdr));
> skb_reset_transport_header(cdev->askb);
> - memset(cdev->askb->data, 0, cdev->askb->len);
These two are NOT equivalent.
--
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-08-15 5:01 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-07 15:40 [PATCH] crypto: chtls - use 'skb_put_zero()' instead of re-implementing it Christophe JAILLET
2019-08-15 5:00 ` Herbert Xu
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).