Skip to contentSkip to conversation

crypto: exynoes-rng: Set cra_ctxsize to 0

PATCH In review PrasannaKumar Muralidharan 2 participants 6 messages May 21, 2017 – May 22, 2017

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 crypto: exynoes-rng: Set cra_ctxsize to 0

As cra_ctxsize is set but the allocated space is not used, set it 0.

---
 drivers/crypto/exynos-rng.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/crypto/exynos-rng.c +1 -1
index 451620b..d009df6 100644
@@ -260,7 +260,7 @@ static int exynos_rng_kcapi_init(struct crypto_tfm *tfm)
 		.cra_name		= "stdrng",
 		.cra_driver_name	= "exynos_rng",
 		.cra_priority		= 100,
-		.cra_ctxsize		= sizeof(struct exynos_rng_ctx),
+		.cra_ctxsize		= 0,
 		.cra_module		= THIS_MODULE,
 		.cra_init		= exynos_rng_kcapi_init,
 	}
Signature · 1 line
1.8.5.6
#1 lore raw
Quoted 1 line · PrasannaKumar Muralidharan

As cra_ctxsize is set but the allocated space is not used, set it 0.

Why do you think it is not used? Did you test our change on hardware?

Best regards,
Krzysztof

Quoted 22 lines
---
 drivers/crypto/exynos-rng.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/crypto/exynos-rng.c +1 -2
index 451620b..d009df6 100644
@@ -260,7 +260,7 @@ static int exynos_rng_kcapi_init(struct crypto_tfm *tfm)
                .cra_name               = "stdrng",
                .cra_driver_name        = "exynos_rng",
                .cra_priority           = 100,
-               .cra_ctxsize            = sizeof(struct exynos_rng_ctx),
+               .cra_ctxsize            = 0,
                .cra_module             = THIS_MODULE,
                .cra_init               = exynos_rng_kcapi_init,
        }
--

1.8.5.6

#2 lore raw

Hi Krzysztof

Quoted 5 lines · Krzysztof Kozlowski
Quoted 1 line · PrasannaKumar Muralidharan

As cra_ctxsize is set but the allocated space is not used, set it 0.

Why do you think it is not used? Did you test our change on hardware?

Had a look at the crypto rng code. I think the additional size is used to store driver private data. But this driver does not store any private data in the crypto_tfm structure so I think the 'cra_ctxsize' can be safely set to 0.

I do not have access to the hardware, did not test the change. Sorry I forgot to mention that.

Quoted 9 lines

Best regards,
Krzysztof

Quoted 6 lines
---
 drivers/crypto/exynos-rng.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 16 lines
Quoted 14 lines
drivers/crypto/exynos-rng.c +1 -2
index 451620b..d009df6 100644
@@ -260,7 +260,7 @@ static int exynos_rng_kcapi_init(struct crypto_tfm *tfm)
                .cra_name               = "stdrng",
                .cra_driver_name        = "exynos_rng",
                .cra_priority           = 100,
-               .cra_ctxsize            = sizeof(struct exynos_rng_ctx),
+               .cra_ctxsize            = 0,
                .cra_module             = THIS_MODULE,
                .cra_init               = exynos_rng_kcapi_init,
        }
--
Quoted 2 lines

1.8.5.6

Regards,
PrasannaKumar

#3 lore raw
Quoted 5 lines · PrasannaKumar Muralidharan

Hi Krzysztof

Quoted 2 lines · Krzysztof Kozlowski

On Sun, May 21, 2017 at 8:09 AM, PrasannaKumar Muralidharan <[email protected]> wrote:

Quoted 8 lines
Quoted 3 lines
Quoted 1 line

As cra_ctxsize is set but the allocated space is not used, set it 0.

Why do you think it is not used? Did you test our change on hardware?

Had a look at the crypto rng code. I think the additional size is used to store driver private data. But this driver does not store any private data in the crypto_tfm structure so I think the 'cra_ctxsize' can be safely set to 0.

Then from where does crypto_tfm_ctx() get its memory?

Quoted 2 lines

I do not have access to the hardware, did not test the change. Sorry I forgot to mention that.

That is quite important... By default everything must be tested so if you are skipping this step then please mark the patch respectively so others will provide testing.

Best regards,
Krzysztof

#4 lore raw
Quoted 9 lines · Krzysztof Kozlowski
Quoted 7 lines · PrasannaKumar Muralidharan

Hi Krzysztof

Quoted 4 lines · Krzysztof Kozlowski
Quoted 1 line · PrasannaKumar Muralidharan

As cra_ctxsize is set but the allocated space is not used, set it 0.

Quoted 8 lines
Quoted 6 lines
Quoted 1 line

Why do you think it is not used? Did you test our change on hardware?

Had a look at the crypto rng code. I think the additional size is used to store driver private data. But this driver does not store any private data in the crypto_tfm structure so I think the 'cra_ctxsize' can be safely set to 0.

Then from where does crypto_tfm_ctx() get its memory?

Ah, yes. Thanks for pointing out. I overlooked this. My patch is completely wrong.

Quoted 6 lines
Quoted 2 lines

I do not have access to the hardware, did not test the change. Sorry I forgot to mention that.

That is quite important... By default everything must be tested so if you are skipping this step then please mark the patch respectively so others will provide testing.

Sure. Will keep that in mind. Instead of marking it as a [PATCH] should I use something else for this? Will it make things easier?

Thanks,
PrasannaKumar

#5 lore raw
Quoted 9 lines · PrasannaKumar Muralidharan
Quoted 6 lines
Quoted 2 lines

I do not have access to the hardware, did not test the change. Sorry I forgot to mention that.

That is quite important... By default everything must be tested so if you are skipping this step then please mark the patch respectively so others will provide testing.

Sure. Will keep that in mind. Instead of marking it as a [PATCH] should I use something else for this? Will it make things easier?

If sending untested patch is really necessary, then mark it either as RFT instead of PATCH or add a comment about it after --- separator.

Best regards,
Krzysztof