Re: [PATCH] crypto: using size_add() for kmalloc()

2025-04-21 Thread Christophe JAILLET
Le 21/04/2025 à 09:43, Su Hui a écrit : On 2025/4/21 15:10, Christophe JAILLET wrote: Le 21/04/2025 à 07:51, Su Hui a écrit : It's safer to use size_add() to replace open-coded aithmetic in allocator arguments, because size_add() can prevent possible overflow problem. Signed-off-by: S

Re: [PATCH] crypto: using size_add() for kmalloc()

2025-04-21 Thread Christophe JAILLET
Le 21/04/2025 à 07:51, Su Hui a écrit : It's safer to use size_add() to replace open-coded aithmetic in allocator arguments, because size_add() can prevent possible overflow problem. Signed-off-by: Su Hui --- include/crypto/aead.h | 3 ++- include/crypto/akcipher.h | 4 +++- include/cry

[PATCH] crypto: virtio - Erase some sensitive memory when it is freed

2025-03-03 Thread Christophe JAILLET
virtcrypto_clear_request() does the same as the code here, but uses kfree_sensitive() for one of the free operation. So, better safe than sorry, use virtcrypto_clear_request() directly to save a few lines of code and cleanly free the memory. Signed-off-by: Christophe JAILLET --- I've no id

[PATCH] crypto: crc32-generic - Use SPDX-License-Identifier

2021-04-10 Thread Christophe JAILLET
Use SPDX-License-Identifier: GPL-2.0-only, instead of hand writing it. This also removes a reference to http://www.xyratex.com which seems to be down. Signed-off-by: Christophe JAILLET --- crypto/crc32_generic.c | 24 +--- 1 file changed, 1 insertion(+), 23 deletions

[PATCH] hwrng: ingenic - Fix a resource leak in an error handling path

2020-12-18 Thread Christophe JAILLET
In case of error, we should call 'clk_disable_unprepare()' to undo a previous 'clk_prepare_enable()' call, as already done in the remove function. Fixes: 406346d22278 ("hwrng: ingenic - Add hardware TRNG for Ingenic X1830") Signed-off-by: Christophe JAILLET ---

Re: [PATCH] crypto: qat - Use dma_set_mask_and_coherent to simplify code

2020-11-26 Thread Christophe JAILLET
Le 26/11/2020 à 13:04, Giovanni Cabiddu a écrit : Hi Christophe, On Sat, Nov 21, 2020 at 07:13:59AM +, Christophe JAILLET wrote: 'pci_set_dma_mask()' + 'pci_set_consistent_dma_mask()' can be replaced by an equivalent 'dma_set_mask_and_coherent()' which is m

[PATCH] crypto: cavium - Use dma_set_mask_and_coherent to simplify code

2020-11-20 Thread Christophe JAILLET
'pci_set_dma_mask()' + 'pci_set_consistent_dma_mask()' can be replaced by an equivalent 'dma_set_mask_and_coherent()' which is much less verbose. Signed-off-by: Christophe JAILLET --- drivers/crypto/cavium/cpt/cptpf_main.c | 10 ++ drivers/crypt

[PATCH] crypto: marvell/octeontx - Use dma_set_mask_and_coherent to simplify code

2020-11-20 Thread Christophe JAILLET
'pci_set_dma_mask()' + 'pci_set_consistent_dma_mask()' can be replaced by an equivalent 'dma_set_mask_and_coherent()' which is much less verbose. Signed-off-by: Christophe JAILLET --- drivers/crypto/marvell/octeontx/otx_cptpf_main.c | 10 ++ d

[PATCH] crypto: cavium/zip - Use dma_set_mask_and_coherent to simplify code

2020-11-20 Thread Christophe JAILLET
'pci_set_dma_mask()' + 'pci_set_consistent_dma_mask()' can be replaced by an equivalent 'dma_set_mask_and_coherent()' which is much less verbose. Signed-off-by: Christophe JAILLET --- drivers/crypto/cavium/zip/zip_main.c | 10 ++ 1 file changed, 2 inser

[PATCH] crypto: qat - Use dma_set_mask_and_coherent to simplify code

2020-11-20 Thread Christophe JAILLET
'pci_set_dma_mask()' + 'pci_set_consistent_dma_mask()' can be replaced by an equivalent 'dma_set_mask_and_coherent()' which is much less verbose. While at it, also remove some unless extra () in the 32 bits case. Signed-off-by: Christophe JAILLET --- Instead of re

[PATCH] crypto: ixp4xx - Fix the size used in a 'dma_free_coherent()' call

2020-08-02 Thread Christophe JAILLET
Update the size used in 'dma_free_coherent()' in order to match the one used in the corresponding 'dma_alloc_coherent()', in 'setup_crypt_desc()'. Fixes: 81bef0150074 ("crypto: ixp4xx - Hardware crypto support for IXP4xx CPUs") Signed-off-by:

[PATCH] crypto: hifn_795x - switch from 'pci_' to 'dma_' API

2020-07-27 Thread Christophe JAILLET
@@ expression e1, e2; @@ -pci_set_consistent_dma_mask(e1, e2) +dma_set_coherent_mask(&e1->dev, e2) Signed-off-by: Christophe JAILLET --- If needed, see post from Christoph Hellwig on the kernel-janitors ML: https://marc.info/?l=kernel-janitors&m=158745678307186&w=4

[PATCH 1/2] Crypto/chcr: Avoid some code duplication

2020-07-12 Thread Christophe JAILLET
The error handling path of 'chcr_authenc_setkey()' is the same as this error handling code. So just 'goto out' as done everywhere in the function to simplify the code. Signed-off-by: Christophe JAILLET --- drivers/crypto/chelsio/chcr_algo.c | 4 +--- 1 file changed, 1 inser

[PATCH 2/2] Crypto/chcr: Fix some pr_xxx messages

2020-07-12 Thread Christophe JAILLET
At the top this file, we have: #define pr_fmt(fmt) "chcr:" fmt So there is no need to repeat "chcr : " in some error message when the pr_xxx macro is used. This would lead to log "chcr:chcr : blabla" Signed-off-by: Christophe JAILLET --- drivers/c

[PATCH v2] crypto: cavium/nitrox - Fix 'nitrox_get_first_device()' when ndevlist is fully iterated

2020-05-30 Thread Christophe JAILLET
ported crypto algorithms.") Signed-off-by: Christophe JAILLET --- v2: Do not introduce an extra variable to check if the list has been fully iterated. Test with "if (&ndev->list == &ndevlist)" instead --- drivers/crypto/cavium/nitrox/nitrox_main.c | 4 ++-- 1 file cha

[PATCH] crypto: cavium/nitrox - Fix 'nitrox_get_first_device()' when ndevlist is fully iterated

2020-05-19 Thread Christophe JAILLET
upported crypto algorithms.") Signed-off-by: Christophe JAILLET --- drivers/crypto/cavium/nitrox/nitrox_main.c | 9 ++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/crypto/cavium/nitrox/nitrox_main.c b/drivers/crypto/cavium/nitrox/nitrox_main.c index 788c6607078b..172ca

[PATCH] crypto: cavium/nitrox - Fix a typo in a comment

2020-05-19 Thread Christophe JAILLET
s/NITORX/NITROX/ Signed-off-by: Christophe JAILLET --- drivers/crypto/cavium/nitrox/nitrox_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/crypto/cavium/nitrox/nitrox_main.c b/drivers/crypto/cavium/nitrox/nitrox_main.c index e91be9b8b083..788c6607078b 100644

[PATCH] crypto: chtls - simplify a bit 'create_flowc_wr_skb()'

2019-09-19 Thread Christophe JAILLET
Use '__skb_put_data()' instead of rewritting it. This improves readability. Signed-off-by: Christophe JAILLET --- drivers/crypto/chelsio/chtls/chtls_io.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/crypto/chelsio/chtls/chtls_io.c b/drivers/crypto/che

[PATCH] crypto: picoxcell - Fix the name of the module in the description of CRYPTO_DEV_PICOXCELL

2019-08-18 Thread Christophe JAILLET
The help section says that the module will be called 'pipcoxcell_crypto'. This is likely a typo. Use 'picoxcell_crypto' instead Signed-off-by: Christophe JAILLET --- drivers/crypto/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/cryp

[PATCH] crypto: chtls - use 'skb_put_zero()' instead of re-implementing it

2019-08-07 Thread 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 --- drivers/crypto/chelsio/chtls/chtls_main.c | 3 +-- 1 file changed, 1 insertion(+),

[PATCH] crypto: hifn_795x - Fix a memory leak in the error handling path of 'hifn_probe()'

2017-11-18 Thread Christophe JAILLET
'dev' is leaking in the error handling path of 'hifn_probe()'. Add a 'kfree(dev)' to match the code in 'hifn_remove()' Signed-off-by: Christophe JAILLET --- drivers/crypto/hifn_795x.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/crypto/

Re: [PATCH 1/2] crypto: lrw - Fix an error handling path in 'create()'

2017-10-09 Thread Christophe JAILLET
Le 09/10/2017 à 23:22, walter harms a écrit : Am 08.10.2017 11:39, schrieb Christophe JAILLET: All error handling paths 'goto err_drop_spawn' except this one. In order to avoid some resources leak, we should do it as well here. Fixes: 700cb3f5fe75 ("crypto: lrw - Convert to sk

[PATCH 1/2] crypto: lrw - Fix an error handling path in 'create()'

2017-10-08 Thread Christophe JAILLET
All error handling paths 'goto err_drop_spawn' except this one. In order to avoid some resources leak, we should do it as well here. Fixes: 700cb3f5fe75 ("crypto: lrw - Convert to skcipher") Signed-off-by: Christophe JAILLET --- crypto/lrw.c | 6 -- 1 file changed

[PATCH 2/2] crypto: lrw - Check for incorrect cipher name

2017-10-08 Thread Christophe JAILLET
If the cipher name does not start with 'ecb(' we should bail out, as done in the 'create()' function in 'crypto/xts.c'. Fixes: 700cb3f5fe75 ("crypto: lrw - Convert to skcipher") Signed-off-by: Christophe JAILLET --- This patch is 100% speculative. It

[PATCH 0/2] crypto: lrw - Fixes for the 'create()' function

2017-10-08 Thread Christophe JAILLET
crypto/xts.c' and 'crypto/lrw.c' look very similar. However, there is one more sanity check in xts. This patch proposes to add the same test in lrw. Not sure at all if correct! I just send it for consistency. Christophe JAILLET (2): crypto: lrw - Fix an error handling path in '

[PATCH] crypto: xts - Fix an error handling path in 'create()'

2017-09-25 Thread Christophe JAILLET
All error handling paths 'goto err_drop_spawn' except this one. In order to avoid some resources leak, we should do it as well here. Fixes: f1c131b45410 ("crypto: xts - Convert to skcipher") Signed-off-by: Christophe JAILLET --- crypto/xts.c | 6 -- 1 file changed

[PATCH] crypto: cavium/nitrox - Fix an error handling path in 'nitrox_probe()'

2017-08-15 Thread Christophe JAILLET
'err' is known to be 0 at this point. If 'kzalloc()' fails, returns -ENOMEM instead of 0 which means success. Signed-off-by: Christophe JAILLET --- drivers/crypto/cavium/nitrox/nitrox_main.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/

[PATCH] crypto: inside-secure - fix an error handling path in safexcel_probe()

2017-08-15 Thread Christophe JAILLET
'ret' is known to be 0 at this point. If 'safexcel_request_ring_irq()' fails, it returns an error code. Return this value instead of 0 which means success. Signed-off-by: Christophe JAILLET --- drivers/crypto/inside-secure/safexcel.c | 5 +++-- 1 file changed, 3 insert

[PATCH] crypto: ixp4xx - Fix error handling path in 'aead_perform()'

2017-07-19 Thread Christophe JAILLET
lised warning") Signed-off-by: Christophe JAILLET --- drivers/crypto/ixp4xx_crypto.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/crypto/ixp4xx_crypto.c b/drivers/crypto/ixp4xx_crypto.c index 427cbe012729..1ccbe15b5f16 100644 --- a/drivers/crypto/ixp4xx_cryp

[PATCH] crypto: crypto4xx - fix an error code

2017-06-10 Thread Christophe JAILLET
If 'kzalloc' fails, we return 0 which means success. return -ENOMEM instead as already done a few lines above. Signed-off-by: Christophe JAILLET --- drivers/crypto/amcc/crypto4xx_core.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/crypto/amcc/crypto4xx_core.c b/driv

[PATCH v2] crypto: chcr - Fix error handling related to 'chcr_alloc_shash'

2017-04-13 Thread Christophe JAILLET
ing. Also fix a crash in 'chcr_authenc_setkey()' if 'chcr_alloc_shash()' returns an error pointer and the "goto out" path is taken. Signed-off-by: Christophe JAILLET --- v2: Modify 'chcr_alloc_shash' to return ERR_PTR(-EINVAL) instead of NULL in case

Re: [PATCH 2/2] crypto: chcr - Fix error checking

2017-04-13 Thread Christophe JAILLET
Le 13/04/2017 à 18:13, Dan Carpenter a écrit : On Thu, Apr 13, 2017 at 08:37:50PM +0530, Harsh Jain wrote: On Thu, Apr 13, 2017 at 8:20 PM, Christophe JAILLET wrote: Le 13/04/2017 à 16:04, Dan Carpenter a écrit : On Thu, Apr 13, 2017 at 02:14:30PM +0200, Christophe JAILLET wrote: If

Re: [PATCH 2/2] crypto: chcr - Fix error checking

2017-04-13 Thread Christophe JAILLET
Le 13/04/2017 à 16:04, Dan Carpenter a écrit : On Thu, Apr 13, 2017 at 02:14:30PM +0200, Christophe JAILLET wrote: If 'chcr_alloc_shash()' a few lines above fails, 'base_hash' can be an error pointer when we 'goto out'. So checking for NULL here is not en

[PATCH 2/2] crypto: chcr - Fix error checking

2017-04-13 Thread Christophe JAILLET
If 'chcr_alloc_shash()' a few lines above fails, 'base_hash' can be an error pointer when we 'goto out'. So checking for NULL here is not enough because it is likely that 'chcr_free_shash' will crash if we pass an error pointer. Signed-off-by: Christophe JA

[PATCH 0/2] Fix/improve some error handling related to 'chcr_alloc_shash'

2017-04-13 Thread Christophe JAILLET
This serie is divided into 2 patches. They are more or less related to the same issue, but the first patch is not a bug in itself, just a clean-up (IMHO). If I'm correct, the 2nd one, is a real (unlikely) issue. Christophe JAILLET (2): crypto: chcr - Improve error checking crypto: chcr

[PATCH 1/2] crypto: chcr - Improve error checking

2017-04-13 Thread Christophe JAILLET
check for NULL. Signed-off-by: Christophe JAILLET --- drivers/crypto/chelsio/chcr_algo.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/crypto/chelsio/chcr_algo.c b/drivers/crypto/chelsio/chcr_algo.c index 41bc7f4f58cd..f19590ac8775 100644 --- a/drivers/crypto/chelsio/ch

[PATCH] crypto: crypto4xx - Fix size used in dma_free_coherent()

2016-10-07 Thread Christophe JAILLET
sizes look different: '%s' vs '%s'" % (y0, y1) Signed-off-by: Christophe JAILLET --- drivers/crypto/amcc/crypto4xx_core.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/crypto/amcc/crypto4xx_core.c b/drivers

Re: [PATCH] crypto: omap: Free memory in error path

2015-01-25 Thread Christophe JAILLET
Oups, should be: free_pages((unsigned long)buf_out, pages); free_pages((unsigned long)buf_in, pages); CJ Le 26/01/2015 06:40, Christophe Jaillet a écrit : If only one of the 2 __get_free_pages fails, then there is a memory leak Signed-off-by: Christophe Jaillet --- drivers

[PATCH] crypto: omap: Free memory in error path

2015-01-25 Thread Christophe Jaillet
If only one of the 2 __get_free_pages fails, then there is a memory leak Signed-off-by: Christophe Jaillet --- drivers/crypto/omap-aes.c | 2 ++ drivers/crypto/omap-des.c | 2 ++ 2 files changed, 4 insertions(+) diff --git a/drivers/crypto/omap-aes.c b/drivers/crypto/omap-aes.c index f79dd41

[PATCH] crypto: atmel: Free memory in error path

2015-01-19 Thread Christophe Jaillet
If only one of the 2 __get_free_pages fails, then there is a memory leak. Signed-off-by: Christophe Jaillet --- drivers/crypto/atmel-aes.c | 2 +- drivers/crypto/atmel-tdes.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/crypto/atmel-aes.c b/drivers/crypto