linux-crypto.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/3] crypto: sa2ul - Hide pointer and fix -Wpointer-to-int-cast in dev_dbg()
@ 2020-08-26 16:29 Krzysztof Kozlowski
  2020-08-26 16:29 ` [PATCH 2/3] crypto: sa2ul - Simplify with dev_err_probe() Krzysztof Kozlowski
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Krzysztof Kozlowski @ 2020-08-26 16:29 UTC (permalink / raw)
  To: Gilad Ben-Yossef, Herbert Xu, David S. Miller, linux-crypto,
	linux-kernel
  Cc: Krzysztof Kozlowski

Pointers should not be printed because they might leak important
information about address space layout.  Use %p to hash the value.  This
also fixes compilation warnings on 32-bit architecture:

    drivers/crypto/sa2ul.c:1486:33: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]

Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
---
 drivers/crypto/sa2ul.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/crypto/sa2ul.c b/drivers/crypto/sa2ul.c
index 5bc099052bd2..4a950437bf44 100644
--- a/drivers/crypto/sa2ul.c
+++ b/drivers/crypto/sa2ul.c
@@ -1482,8 +1482,8 @@ static int sa_sha_init(struct ahash_request *req)
 	struct sa_sha_req_ctx *rctx = ahash_request_ctx(req);
 	struct sa_tfm_ctx *ctx = crypto_ahash_ctx(tfm);
 
-	dev_dbg(sa_k3_dev, "init: digest size: %d, rctx=%llx\n",
-		crypto_ahash_digestsize(tfm), (u64)rctx);
+	dev_dbg(sa_k3_dev, "init: digest size: %d, rctx=%p\n",
+		crypto_ahash_digestsize(tfm), rctx);
 
 	ahash_request_set_tfm(&rctx->fallback_req, ctx->fallback.ahash);
 	rctx->fallback_req.base.flags =
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 2/3] crypto: sa2ul - Simplify with dev_err_probe()
  2020-08-26 16:29 [PATCH 1/3] crypto: sa2ul - Hide pointer and fix -Wpointer-to-int-cast in dev_dbg() Krzysztof Kozlowski
@ 2020-08-26 16:29 ` Krzysztof Kozlowski
  2020-08-26 16:29 ` [PATCH 3/3] crypto: ccree " Krzysztof Kozlowski
  2020-09-04  8:28 ` [PATCH 1/3] crypto: sa2ul - Hide pointer and fix -Wpointer-to-int-cast in dev_dbg() Herbert Xu
  2 siblings, 0 replies; 7+ messages in thread
From: Krzysztof Kozlowski @ 2020-08-26 16:29 UTC (permalink / raw)
  To: Gilad Ben-Yossef, Herbert Xu, David S. Miller, linux-crypto,
	linux-kernel
  Cc: Krzysztof Kozlowski

Common pattern of handling deferred probe can be simplified with
dev_err_probe().  Less code and also it prints the error value.

Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
---
 drivers/crypto/sa2ul.c | 18 +++++++-----------
 1 file changed, 7 insertions(+), 11 deletions(-)

diff --git a/drivers/crypto/sa2ul.c b/drivers/crypto/sa2ul.c
index 4a950437bf44..5a11c2fb7a3a 100644
--- a/drivers/crypto/sa2ul.c
+++ b/drivers/crypto/sa2ul.c
@@ -2243,25 +2243,21 @@ static int sa_dma_init(struct sa_crypto_data *dd)
 		return ret;
 
 	dd->dma_rx1 = dma_request_chan(dd->dev, "rx1");
-	if (IS_ERR(dd->dma_rx1)) {
-		if (PTR_ERR(dd->dma_rx1) != -EPROBE_DEFER)
-			dev_err(dd->dev, "Unable to request rx1 DMA channel\n");
-		return PTR_ERR(dd->dma_rx1);
-	}
+	if (IS_ERR(dd->dma_rx1))
+		return dev_err_probe(dd->dev, PTR_ERR(dd->dma_rx1),
+				     "Unable to request rx1 DMA channel\n");
 
 	dd->dma_rx2 = dma_request_chan(dd->dev, "rx2");
 	if (IS_ERR(dd->dma_rx2)) {
 		dma_release_channel(dd->dma_rx1);
-		if (PTR_ERR(dd->dma_rx2) != -EPROBE_DEFER)
-			dev_err(dd->dev, "Unable to request rx2 DMA channel\n");
-		return PTR_ERR(dd->dma_rx2);
+		return dev_err_probe(dd->dev, PTR_ERR(dd->dma_rx2),
+				     "Unable to request rx2 DMA channel\n");
 	}
 
 	dd->dma_tx = dma_request_chan(dd->dev, "tx");
 	if (IS_ERR(dd->dma_tx)) {
-		if (PTR_ERR(dd->dma_tx) != -EPROBE_DEFER)
-			dev_err(dd->dev, "Unable to request tx DMA channel\n");
-		ret = PTR_ERR(dd->dma_tx);
+		ret = dev_err_probe(dd->dev, PTR_ERR(dd->dma_tx),
+				    "Unable to request tx DMA channel\n");
 		goto err_dma_tx;
 	}
 
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 3/3] crypto: ccree - Simplify with dev_err_probe()
  2020-08-26 16:29 [PATCH 1/3] crypto: sa2ul - Hide pointer and fix -Wpointer-to-int-cast in dev_dbg() Krzysztof Kozlowski
  2020-08-26 16:29 ` [PATCH 2/3] crypto: sa2ul - Simplify with dev_err_probe() Krzysztof Kozlowski
@ 2020-08-26 16:29 ` Krzysztof Kozlowski
  2020-09-04  8:28 ` [PATCH 1/3] crypto: sa2ul - Hide pointer and fix -Wpointer-to-int-cast in dev_dbg() Herbert Xu
  2 siblings, 0 replies; 7+ messages in thread
From: Krzysztof Kozlowski @ 2020-08-26 16:29 UTC (permalink / raw)
  To: Gilad Ben-Yossef, Herbert Xu, David S. Miller, linux-crypto,
	linux-kernel
  Cc: Krzysztof Kozlowski

Common pattern of handling deferred probe can be simplified with
dev_err_probe().  Less code and also it prints the error value.

Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
---
 drivers/crypto/ccree/cc_driver.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/drivers/crypto/ccree/cc_driver.c b/drivers/crypto/ccree/cc_driver.c
index 2d50991b9a17..6f519d3e896c 100644
--- a/drivers/crypto/ccree/cc_driver.c
+++ b/drivers/crypto/ccree/cc_driver.c
@@ -300,11 +300,8 @@ static int init_cc_resources(struct platform_device *plat_dev)
 	new_drvdata->plat_dev = plat_dev;
 
 	clk = devm_clk_get_optional(dev, NULL);
-	if (IS_ERR(clk)) {
-		if (PTR_ERR(clk) != -EPROBE_DEFER)
-			dev_err(dev, "Error getting clock: %pe\n", clk);
-		return PTR_ERR(clk);
-	}
+	if (IS_ERR(clk))
+		return dev_err_probe(dev, PTR_ERR(clk), "Error getting clock\n");
 	new_drvdata->clk = clk;
 
 	new_drvdata->coherent = of_dma_is_coherent(np);
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH 1/3] crypto: sa2ul - Hide pointer and fix -Wpointer-to-int-cast in dev_dbg()
  2020-08-26 16:29 [PATCH 1/3] crypto: sa2ul - Hide pointer and fix -Wpointer-to-int-cast in dev_dbg() Krzysztof Kozlowski
  2020-08-26 16:29 ` [PATCH 2/3] crypto: sa2ul - Simplify with dev_err_probe() Krzysztof Kozlowski
  2020-08-26 16:29 ` [PATCH 3/3] crypto: ccree " Krzysztof Kozlowski
@ 2020-09-04  8:28 ` Herbert Xu
  2021-02-27 16:37   ` Krzysztof Kozlowski
  2 siblings, 1 reply; 7+ messages in thread
From: Herbert Xu @ 2020-09-04  8:28 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: Gilad Ben-Yossef, David S. Miller, linux-crypto, linux-kernel

On Wed, Aug 26, 2020 at 06:29:52PM +0200, Krzysztof Kozlowski wrote:
> Pointers should not be printed because they might leak important
> information about address space layout.  Use %p to hash the value.  This
> also fixes compilation warnings on 32-bit architecture:
> 
>     drivers/crypto/sa2ul.c:1486:33: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
> 
> Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
> ---
>  drivers/crypto/sa2ul.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

All applied.  Thanks.
-- 
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] 7+ messages in thread

* Re: [PATCH 1/3] crypto: sa2ul - Hide pointer and fix -Wpointer-to-int-cast in dev_dbg()
  2020-09-04  8:28 ` [PATCH 1/3] crypto: sa2ul - Hide pointer and fix -Wpointer-to-int-cast in dev_dbg() Herbert Xu
@ 2021-02-27 16:37   ` Krzysztof Kozlowski
  2021-03-01  6:36     ` Herbert Xu
  0 siblings, 1 reply; 7+ messages in thread
From: Krzysztof Kozlowski @ 2021-02-27 16:37 UTC (permalink / raw)
  To: Herbert Xu; +Cc: Gilad Ben-Yossef, David S. Miller, linux-crypto, linux-kernel

On Fri, 4 Sept 2020 at 10:28, Herbert Xu <herbert@gondor.apana.org.au> wrote:
>
> On Wed, Aug 26, 2020 at 06:29:52PM +0200, Krzysztof Kozlowski wrote:
> > Pointers should not be printed because they might leak important
> > information about address space layout.  Use %p to hash the value.  This
> > also fixes compilation warnings on 32-bit architecture:
> >
> >     drivers/crypto/sa2ul.c:1486:33: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
> >
> > Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
> > ---
> >  drivers/crypto/sa2ul.c | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
>
> All applied.  Thanks.

Hi Herbert,

I think this patch was lost, although you replied that the entire set
is applied.

Can you pick it up?

Best regards,
Krzysztof

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 1/3] crypto: sa2ul - Hide pointer and fix -Wpointer-to-int-cast in dev_dbg()
  2021-02-27 16:37   ` Krzysztof Kozlowski
@ 2021-03-01  6:36     ` Herbert Xu
  2021-03-01  6:41       ` Krzysztof Kozlowski
  0 siblings, 1 reply; 7+ messages in thread
From: Herbert Xu @ 2021-03-01  6:36 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: Gilad Ben-Yossef, David S. Miller, linux-crypto, linux-kernel

On Sat, Feb 27, 2021 at 05:37:49PM +0100, Krzysztof Kozlowski wrote:
>
> I think this patch was lost, although you replied that the entire set
> is applied.
> 
> Can you pick it up?

I think it was not applicable because the following had already
been applied:

commit ea066b7a3ddf1e4e5ae749495f0adf12766188b4
Author: YueHaibing <yuehaibing@huawei.com>
Date:   Tue Aug 18 22:00:01 2020 +0800

    crypto: sa2ul - Fix pointer-to-int-cast warning

Thanks,
-- 
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] 7+ messages in thread

* Re: [PATCH 1/3] crypto: sa2ul - Hide pointer and fix -Wpointer-to-int-cast in dev_dbg()
  2021-03-01  6:36     ` Herbert Xu
@ 2021-03-01  6:41       ` Krzysztof Kozlowski
  0 siblings, 0 replies; 7+ messages in thread
From: Krzysztof Kozlowski @ 2021-03-01  6:41 UTC (permalink / raw)
  To: Herbert Xu; +Cc: Gilad Ben-Yossef, David S. Miller, linux-crypto, linux-kernel

On Mon, 1 Mar 2021 at 07:36, Herbert Xu <herbert@gondor.apana.org.au> wrote:
>
> On Sat, Feb 27, 2021 at 05:37:49PM +0100, Krzysztof Kozlowski wrote:
> >
> > I think this patch was lost, although you replied that the entire set
> > is applied.
> >
> > Can you pick it up?
>
> I think it was not applicable because the following had already
> been applied:
>
> commit ea066b7a3ddf1e4e5ae749495f0adf12766188b4
> Author: YueHaibing <yuehaibing@huawei.com>
> Date:   Tue Aug 18 22:00:01 2020 +0800
>
>     crypto: sa2ul - Fix pointer-to-int-cast warning

Yes, you're right. Sorry for the noise.

Best regards,
Krzysztof

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2021-03-01  6:42 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-26 16:29 [PATCH 1/3] crypto: sa2ul - Hide pointer and fix -Wpointer-to-int-cast in dev_dbg() Krzysztof Kozlowski
2020-08-26 16:29 ` [PATCH 2/3] crypto: sa2ul - Simplify with dev_err_probe() Krzysztof Kozlowski
2020-08-26 16:29 ` [PATCH 3/3] crypto: ccree " Krzysztof Kozlowski
2020-09-04  8:28 ` [PATCH 1/3] crypto: sa2ul - Hide pointer and fix -Wpointer-to-int-cast in dev_dbg() Herbert Xu
2021-02-27 16:37   ` Krzysztof Kozlowski
2021-03-01  6:36     ` Herbert Xu
2021-03-01  6:41       ` Krzysztof Kozlowski

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).