Re: [PATCH] crypto: Used macros from compiler.h instead of __attribute__(...))

2016-12-30 Thread kbuild test robot
Hi =,

[auto build test ERROR on cryptodev/master]
[also build test ERROR on v4.10-rc1 next-20161224]
[if your patch is applied to the wrong git tree, please drop us a note to help 
improve the system]

url:
https://github.com/0day-ci/linux/commits/gidisrael-gmail-com/crypto-Used-macros-from-compiler-h-instead-of-__attribute__/20161231-072412
base:   
https://git.kernel.org/pub/scm/linux/kernel/git/herbert/cryptodev-2.6.git master
config: tile-allmodconfig (attached as .config)
compiler: tilegx-linux-gcc (GCC) 4.6.2
reproduce:
wget 
https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross
 -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=tile 

All errors (new ones prefixed by >>):

   crypto/shash.c: In function 'shash_update_unaligned':
>> crypto/shash.c:84:3: error: requested alignment is not a constant
   crypto/shash.c: In function 'shash_final_unaligned':
   crypto/shash.c:120:3: error: requested alignment is not a constant

vim +84 crypto/shash.c

78  struct crypto_shash *tfm = desc->tfm;
79  struct shash_alg *shash = crypto_shash_alg(tfm);
80  unsigned long alignmask = crypto_shash_alignmask(tfm);
81  unsigned int unaligned_len = alignmask + 1 -
82   ((unsigned long)data & alignmask);
83  u8 ubuf[shash_align_buffer_size(unaligned_len, alignmask)]
  > 84  __aligned(aligned);
85  u8 *buf = PTR_ALIGN([0], alignmask + 1);
86  int err;
87  

---
0-DAY kernel test infrastructureOpen Source Technology Center
https://lists.01.org/pipermail/kbuild-all   Intel Corporation


.config.gz
Description: application/gzip


Re: [PATCH] crypto: Used macros from compiler.h instead of __attribute__(...))

2016-12-30 Thread kbuild test robot
Hi =,

[auto build test ERROR on cryptodev/master]
[also build test ERROR on v4.10-rc1 next-20161224]
[if your patch is applied to the wrong git tree, please drop us a note to help 
improve the system]

url:
https://github.com/0day-ci/linux/commits/gidisrael-gmail-com/crypto-Used-macros-from-compiler-h-instead-of-__attribute__/20161231-072412
base:   
https://git.kernel.org/pub/scm/linux/kernel/git/herbert/cryptodev-2.6.git master
config: tile-allmodconfig (attached as .config)
compiler: tilegx-linux-gcc (GCC) 4.6.2
reproduce:
wget 
https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross
 -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=tile 

All errors (new ones prefixed by >>):

   crypto/shash.c: In function 'shash_update_unaligned':
>> crypto/shash.c:84:3: error: requested alignment is not a constant
   crypto/shash.c: In function 'shash_final_unaligned':
   crypto/shash.c:120:3: error: requested alignment is not a constant

vim +84 crypto/shash.c

78  struct crypto_shash *tfm = desc->tfm;
79  struct shash_alg *shash = crypto_shash_alg(tfm);
80  unsigned long alignmask = crypto_shash_alignmask(tfm);
81  unsigned int unaligned_len = alignmask + 1 -
82   ((unsigned long)data & alignmask);
83  u8 ubuf[shash_align_buffer_size(unaligned_len, alignmask)]
  > 84  __aligned(aligned);
85  u8 *buf = PTR_ALIGN([0], alignmask + 1);
86  int err;
87  

---
0-DAY kernel test infrastructureOpen Source Technology Center
https://lists.01.org/pipermail/kbuild-all   Intel Corporation


.config.gz
Description: application/gzip


[PATCH] crypto: Used macros from compiler.h instead of __attribute__(...))

2016-12-30 Thread gidisrael
From: = <=>

This continues from this commit: 52f5684c8e1e
("kernel: use macros from compiler.h instead of __attribute__((...))")

I submitted 4 total patches. They are part of task I've taken up to
increase compiler portability in the kernel. I've cleaned up the
subsystems under /kernel /mm /block and /security, this patch targets
/crypto.

There is  which provides macros for various gcc specific
constructs. Eg: __weak for __attribute__((weak)). I've cleaned all
instances of gcc specific attributes with the right macros for the crypto
subsystem.

I had to make one additional change into compiler-gcc.h for the case when
one wants to use this: __attribute__((aligned) and not specify an alignment
factor. From the gcc docs, this will result in the largest alignment for
that data type on the target machine so I've named the macro
__aligned_largest. Please advise if another name is more appropriate.

RFC: There are many places where __attribute((unused)) is used. There are
two macros for the exact same macro inside compiler-gcc.h:
__always_unused and __maybe_unused. I'm not sure which to have used to
replace instances inside /crypto. Should there perhaps be just an unused
macro. There are 1830 instances of __maybe_unused inside the kernel
code and 110 uses of__always_unused excluding my changes.

Signed-off-by: Gideon Israel Dsouza 
---
 crypto/ablkcipher.c  | 5 +++--
 crypto/acompress.c   | 3 ++-
 crypto/aead.c| 3 ++-
 crypto/ahash.c   | 3 ++-
 crypto/akcipher.c| 3 ++-
 crypto/blkcipher.c   | 7 ---
 crypto/cts.c | 5 +++--
 crypto/kpp.c | 3 ++-
 crypto/pcbc.c| 3 ++-
 crypto/rng.c | 3 ++-
 crypto/scompress.c   | 3 ++-
 crypto/shash.c   | 9 +
 crypto/skcipher.c| 3 ++-
 include/linux/compiler-gcc.h | 1 +
 14 files changed, 34 insertions(+), 20 deletions(-)

diff --git a/crypto/ablkcipher.c b/crypto/ablkcipher.c
index d676fc5..764aca2 100644
--- a/crypto/ablkcipher.c
+++ b/crypto/ablkcipher.c
@@ -19,6 +19,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 
 #include 
@@ -394,7 +395,7 @@ static int crypto_ablkcipher_report(struct sk_buff *skb, 
struct crypto_alg *alg)
 #endif
 
 static void crypto_ablkcipher_show(struct seq_file *m, struct crypto_alg *alg)
-   __attribute__ ((unused));
+   __always_unused;
 static void crypto_ablkcipher_show(struct seq_file *m, struct crypto_alg *alg)
 {
struct ablkcipher_alg *ablkcipher = >cra_ablkcipher;
@@ -468,7 +469,7 @@ static int crypto_givcipher_report(struct sk_buff *skb, 
struct crypto_alg *alg)
 #endif
 
 static void crypto_givcipher_show(struct seq_file *m, struct crypto_alg *alg)
-   __attribute__ ((unused));
+   __always_unused;
 static void crypto_givcipher_show(struct seq_file *m, struct crypto_alg *alg)
 {
struct ablkcipher_alg *ablkcipher = >cra_ablkcipher;
diff --git a/crypto/acompress.c b/crypto/acompress.c
index 887783d..4cb3ad5 100644
--- a/crypto/acompress.c
+++ b/crypto/acompress.c
@@ -20,6 +20,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -50,7 +51,7 @@ static int crypto_acomp_report(struct sk_buff *skb, struct 
crypto_alg *alg)
 #endif
 
 static void crypto_acomp_show(struct seq_file *m, struct crypto_alg *alg)
-   __attribute__ ((unused));
+   __always_unused;
 
 static void crypto_acomp_show(struct seq_file *m, struct crypto_alg *alg)
 {
diff --git a/crypto/aead.c b/crypto/aead.c
index 3f5c5ff..725d513 100644
--- a/crypto/aead.c
+++ b/crypto/aead.c
@@ -24,6 +24,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 
 #include "internal.h"
@@ -132,7 +133,7 @@ static int crypto_aead_report(struct sk_buff *skb, struct 
crypto_alg *alg)
 #endif
 
 static void crypto_aead_show(struct seq_file *m, struct crypto_alg *alg)
-   __attribute__ ((unused));
+   __always_unused;
 static void crypto_aead_show(struct seq_file *m, struct crypto_alg *alg)
 {
struct aead_alg *aead = container_of(alg, struct aead_alg, base);
diff --git a/crypto/ahash.c b/crypto/ahash.c
index 2ce8bcb..35b7871 100644
--- a/crypto/ahash.c
+++ b/crypto/ahash.c
@@ -23,6 +23,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 
 #include "internal.h"
@@ -493,7 +494,7 @@ static int crypto_ahash_report(struct sk_buff *skb, struct 
crypto_alg *alg)
 #endif
 
 static void crypto_ahash_show(struct seq_file *m, struct crypto_alg *alg)
-   __attribute__ ((unused));
+   __always_unused;
 static void crypto_ahash_show(struct seq_file *m, struct crypto_alg *alg)
 {
seq_printf(m, "type : ahash\n");
diff --git a/crypto/akcipher.c b/crypto/akcipher.c
index def301e..5443759 100644
--- a/crypto/akcipher.c
+++ b/crypto/akcipher.c
@@ -17,6 +17,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -47,7 +48,7 @@ static int crypto_akcipher_report(struct 

[PATCH] crypto: Used macros from compiler.h instead of __attribute__(...))

2016-12-30 Thread gidisrael
From: = <=>

This continues from this commit: 52f5684c8e1e
("kernel: use macros from compiler.h instead of __attribute__((...))")

I submitted 4 total patches. They are part of task I've taken up to
increase compiler portability in the kernel. I've cleaned up the
subsystems under /kernel /mm /block and /security, this patch targets
/crypto.

There is  which provides macros for various gcc specific
constructs. Eg: __weak for __attribute__((weak)). I've cleaned all
instances of gcc specific attributes with the right macros for the crypto
subsystem.

I had to make one additional change into compiler-gcc.h for the case when
one wants to use this: __attribute__((aligned) and not specify an alignment
factor. From the gcc docs, this will result in the largest alignment for
that data type on the target machine so I've named the macro
__aligned_largest. Please advise if another name is more appropriate.

RFC: There are many places where __attribute((unused)) is used. There are
two macros for the exact same macro inside compiler-gcc.h:
__always_unused and __maybe_unused. I'm not sure which to have used to
replace instances inside /crypto. Should there perhaps be just an unused
macro. There are 1830 instances of __maybe_unused inside the kernel
code and 110 uses of__always_unused excluding my changes.

Signed-off-by: Gideon Israel Dsouza 
---
 crypto/ablkcipher.c  | 5 +++--
 crypto/acompress.c   | 3 ++-
 crypto/aead.c| 3 ++-
 crypto/ahash.c   | 3 ++-
 crypto/akcipher.c| 3 ++-
 crypto/blkcipher.c   | 7 ---
 crypto/cts.c | 5 +++--
 crypto/kpp.c | 3 ++-
 crypto/pcbc.c| 3 ++-
 crypto/rng.c | 3 ++-
 crypto/scompress.c   | 3 ++-
 crypto/shash.c   | 9 +
 crypto/skcipher.c| 3 ++-
 include/linux/compiler-gcc.h | 1 +
 14 files changed, 34 insertions(+), 20 deletions(-)

diff --git a/crypto/ablkcipher.c b/crypto/ablkcipher.c
index d676fc5..764aca2 100644
--- a/crypto/ablkcipher.c
+++ b/crypto/ablkcipher.c
@@ -19,6 +19,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 
 #include 
@@ -394,7 +395,7 @@ static int crypto_ablkcipher_report(struct sk_buff *skb, 
struct crypto_alg *alg)
 #endif
 
 static void crypto_ablkcipher_show(struct seq_file *m, struct crypto_alg *alg)
-   __attribute__ ((unused));
+   __always_unused;
 static void crypto_ablkcipher_show(struct seq_file *m, struct crypto_alg *alg)
 {
struct ablkcipher_alg *ablkcipher = >cra_ablkcipher;
@@ -468,7 +469,7 @@ static int crypto_givcipher_report(struct sk_buff *skb, 
struct crypto_alg *alg)
 #endif
 
 static void crypto_givcipher_show(struct seq_file *m, struct crypto_alg *alg)
-   __attribute__ ((unused));
+   __always_unused;
 static void crypto_givcipher_show(struct seq_file *m, struct crypto_alg *alg)
 {
struct ablkcipher_alg *ablkcipher = >cra_ablkcipher;
diff --git a/crypto/acompress.c b/crypto/acompress.c
index 887783d..4cb3ad5 100644
--- a/crypto/acompress.c
+++ b/crypto/acompress.c
@@ -20,6 +20,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -50,7 +51,7 @@ static int crypto_acomp_report(struct sk_buff *skb, struct 
crypto_alg *alg)
 #endif
 
 static void crypto_acomp_show(struct seq_file *m, struct crypto_alg *alg)
-   __attribute__ ((unused));
+   __always_unused;
 
 static void crypto_acomp_show(struct seq_file *m, struct crypto_alg *alg)
 {
diff --git a/crypto/aead.c b/crypto/aead.c
index 3f5c5ff..725d513 100644
--- a/crypto/aead.c
+++ b/crypto/aead.c
@@ -24,6 +24,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 
 #include "internal.h"
@@ -132,7 +133,7 @@ static int crypto_aead_report(struct sk_buff *skb, struct 
crypto_alg *alg)
 #endif
 
 static void crypto_aead_show(struct seq_file *m, struct crypto_alg *alg)
-   __attribute__ ((unused));
+   __always_unused;
 static void crypto_aead_show(struct seq_file *m, struct crypto_alg *alg)
 {
struct aead_alg *aead = container_of(alg, struct aead_alg, base);
diff --git a/crypto/ahash.c b/crypto/ahash.c
index 2ce8bcb..35b7871 100644
--- a/crypto/ahash.c
+++ b/crypto/ahash.c
@@ -23,6 +23,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 
 #include "internal.h"
@@ -493,7 +494,7 @@ static int crypto_ahash_report(struct sk_buff *skb, struct 
crypto_alg *alg)
 #endif
 
 static void crypto_ahash_show(struct seq_file *m, struct crypto_alg *alg)
-   __attribute__ ((unused));
+   __always_unused;
 static void crypto_ahash_show(struct seq_file *m, struct crypto_alg *alg)
 {
seq_printf(m, "type : ahash\n");
diff --git a/crypto/akcipher.c b/crypto/akcipher.c
index def301e..5443759 100644
--- a/crypto/akcipher.c
+++ b/crypto/akcipher.c
@@ -17,6 +17,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -47,7 +48,7 @@ static int crypto_akcipher_report(struct sk_buff *skb, struct