linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] crypto: x86/camellia - Replace kernel.h with the necessary inclusions
@ 2022-06-05  7:32 Christophe JAILLET
  2022-06-09 10:15 ` Herbert Xu
  0 siblings, 1 reply; 3+ messages in thread
From: Christophe JAILLET @ 2022-06-05  7:32 UTC (permalink / raw)
  To: Herbert Xu, David S. Miller, Thomas Gleixner, Ingo Molnar,
	Borislav Petkov, Dave Hansen, x86, H. Peter Anvin
  Cc: linux-kernel, kernel-janitors, Christophe JAILLET, linux-crypto

When kernel.h is used in the headers it adds a lot into dependency hell,
especially when there are circular dependencies are involved.

Replace kernel.h inclusion with the list of what is really being used.

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
 arch/x86/crypto/camellia.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/crypto/camellia.h b/arch/x86/crypto/camellia.h
index 1dcea79e8f8e..547fb7e30928 100644
--- a/arch/x86/crypto/camellia.h
+++ b/arch/x86/crypto/camellia.h
@@ -4,7 +4,7 @@
 
 #include <crypto/b128ops.h>
 #include <linux/crypto.h>
-#include <linux/kernel.h>
+#include <linux/types.h>
 
 #define CAMELLIA_MIN_KEY_SIZE	16
 #define CAMELLIA_MAX_KEY_SIZE	32
-- 
2.34.1


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

* Re: [PATCH] crypto: x86/camellia - Replace kernel.h with the necessary inclusions
  2022-06-05  7:32 [PATCH] crypto: x86/camellia - Replace kernel.h with the necessary inclusions Christophe JAILLET
@ 2022-06-09 10:15 ` Herbert Xu
  2022-06-09 16:50   ` Christophe JAILLET
  0 siblings, 1 reply; 3+ messages in thread
From: Herbert Xu @ 2022-06-09 10:15 UTC (permalink / raw)
  To: Christophe JAILLET
  Cc: David S. Miller, Thomas Gleixner, Ingo Molnar, Borislav Petkov,
	Dave Hansen, x86, H. Peter Anvin, linux-kernel, kernel-janitors,
	linux-crypto

On Sun, Jun 05, 2022 at 09:32:53AM +0200, Christophe JAILLET wrote:
> When kernel.h is used in the headers it adds a lot into dependency hell,
> especially when there are circular dependencies are involved.
> 
> Replace kernel.h inclusion with the list of what is really being used.
> 
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> ---
>  arch/x86/crypto/camellia.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/x86/crypto/camellia.h b/arch/x86/crypto/camellia.h
> index 1dcea79e8f8e..547fb7e30928 100644
> --- a/arch/x86/crypto/camellia.h
> +++ b/arch/x86/crypto/camellia.h
> @@ -4,7 +4,7 @@
>  
>  #include <crypto/b128ops.h>
>  #include <linux/crypto.h>
> -#include <linux/kernel.h>
> +#include <linux/types.h>
>  
>  #define CAMELLIA_MIN_KEY_SIZE	16
>  #define CAMELLIA_MAX_KEY_SIZE	32

This is not sufficient.  For example, asmlinkage isn't explicitly
defined by any of these header files so it would be relying on an
implicit inclusion which is prone to breakage.

Did you audit the entire file?

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

* Re: [PATCH] crypto: x86/camellia - Replace kernel.h with the necessary inclusions
  2022-06-09 10:15 ` Herbert Xu
@ 2022-06-09 16:50   ` Christophe JAILLET
  0 siblings, 0 replies; 3+ messages in thread
From: Christophe JAILLET @ 2022-06-09 16:50 UTC (permalink / raw)
  To: Herbert Xu
  Cc: David S. Miller, Thomas Gleixner, Ingo Molnar, Borislav Petkov,
	Dave Hansen, x86, H. Peter Anvin, linux-kernel, kernel-janitors,
	linux-crypto

Le 09/06/2022 à 12:15, Herbert Xu a écrit :
> On Sun, Jun 05, 2022 at 09:32:53AM +0200, Christophe JAILLET wrote:
>> When kernel.h is used in the headers it adds a lot into dependency hell,
>> especially when there are circular dependencies are involved.
>>
>> Replace kernel.h inclusion with the list of what is really being used.
>>
>> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
>> ---
>>   arch/x86/crypto/camellia.h | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/arch/x86/crypto/camellia.h b/arch/x86/crypto/camellia.h
>> index 1dcea79e8f8e..547fb7e30928 100644
>> --- a/arch/x86/crypto/camellia.h
>> +++ b/arch/x86/crypto/camellia.h
>> @@ -4,7 +4,7 @@
>>   
>>   #include <crypto/b128ops.h>
>>   #include <linux/crypto.h>
>> -#include <linux/kernel.h>
>> +#include <linux/types.h>
>>   
>>   #define CAMELLIA_MIN_KEY_SIZE	16
>>   #define CAMELLIA_MAX_KEY_SIZE	32
> 
> This is not sufficient.  For example, asmlinkage isn't explicitly
> defined by any of these header files so it would be relying on an
> implicit inclusion which is prone to breakage.

Agreed, I missed that.

> 
> Did you audit the entire file?

Yes, but I missed the asmlinkage.

In fact, I've sent a few "obvious" (but nothing is never obvious at the 
end...) patches like that to see the interest.

I've spotted a few .h file with "easy to check" content.
Mostly #define, function declarations, a few u<something> datatypes.

Then, I made the #include simplification and compile tested the change.

If it worked, I consider that the patch looks fine.


In this particular case, I guess that the 'asmlinkage' should come from 
another #include when "camellia.h" is used.

My goal was not to introduce some new hidden constraints related to the 
order of the included .h. I just wanted to make them explicit (and 
complete) and start to simplify things.


As said, nothing is never obvious, and I'll stay away from this kind of 
changes :)


Thanks a lot for the review.

CJ



> 
> Cheers,


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

end of thread, other threads:[~2022-06-09 16:50 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-05  7:32 [PATCH] crypto: x86/camellia - Replace kernel.h with the necessary inclusions Christophe JAILLET
2022-06-09 10:15 ` Herbert Xu
2022-06-09 16:50   ` Christophe JAILLET

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