For some reason this did not make it into Patchwork. I am re-sending this to the list to try and fix that.





cryptodev-linux/authenc.c: In function ‘pad_record’:
cryptodev-linux/authenc.c:317:2: warning: ISO C90 forbids variable length array ‘pad’ [-Wvla]
  317 |  uint8_t pad[block_size];
      |  ^~~~~~~
  LD [M]  /home/nmenon/Src/opensource/cryptodev-linux/cryptodev.o

Newer kernels enforce build warnings as error now, so.. lets backport an
upstream fix for the same.

Reported-by: Drew Fustini <[email protected]>
Tested-by: Drew Fustini <[email protected]>
Signed-off-by: Nishanth Menon <[email protected]>
Signed-off-by: Drew Fustini <[email protected]>
---
 .../cryptodev/cryptodev-module_%.bbappend     |  5 +-
 ...0001-remove-VLA-usage-from-authenc.c.patch | 60 +++++++++++++++++++
 2 files changed, 64 insertions(+), 1 deletion(-)
create mode 100644 meta-arago-distro/recipes-kernel/cryptodev/files/0001-remove-VLA-usage-from-authenc.c.patch

diff --git a/meta-arago-distro/recipes-kernel/cryptodev/cryptodev-module_%.bbappend b/meta-arago-distro/recipes-kernel/cryptodev/cryptodev-module_%.bbappend
index c210cc4e2613..4f17153ad200 100644
--- a/meta-arago-distro/recipes-kernel/cryptodev/cryptodev-module_%.bbappend
+++ b/meta-arago-distro/recipes-kernel/cryptodev/cryptodev-module_%.bbappend
@@ -2,6 +2,9 @@ PR_append = ".arago1"
  FILESEXTRAPATHS_prepend := "${THISDIR}/files:"
 -SRC_URI += "file://0001-Fix-build-for-Linux-5.11-rc1.patch"
+SRC_URI += " \
+file://0001-Fix-build-for-Linux-5.11-rc1.patch \
+file://0001-remove-VLA-usage-from-authenc.c.patch \
+"
  KERNEL_MODULE_AUTOLOAD += "cryptodev"
diff --git a/meta-arago-distro/recipes-kernel/cryptodev/files/0001-remove-VLA-usage-from-authenc.c.patch b/meta-arago-distro/recipes-kernel/cryptodev/files/0001-remove-VLA-usage-from-authenc.c.patch
new file mode 100644
index 000000000000..c500b47e12af
--- /dev/null
+++ b/meta-arago-distro/recipes-kernel/cryptodev/files/0001-remove-VLA-usage-from-authenc.c.patch
@@ -0,0 +1,60 @@
+From 0acdfe789eb0a7aea20ff104bbd52a14553900db Mon Sep 17 00:00:00 2001
+From: Cristian Stoica <[email protected]>
+Date: Tue, 28 Jul 2020 10:48:12 +0300
+Subject: [PATCH] remove VLA usage from authenc.c
+
+Linux no longer allows VLA use in the kernel, requiring declaration of
+arrays to be up-front. This patch fixes "alloca is no longer permitted
+in linux" build error.
+
+Upstream-status: Backport [e8263d2d682b06a1ee7bcb2791a7cf27a4af38e0]
+
+Suggested-at: https://github.com/cryptodev-linux/cryptodev-linux/pull/49/commits/5b0662b802f40aa5956e095e404c8080828f8858
+Signed-off-by: Cristian Stoica <[email protected]>
+Signed-off-by: Signed-off-by Nishanth Menon <[email protected]>
+---
+ Makefile  | 2 +-
+ authenc.c | 5 +++--
+ 2 files changed, 4 insertions(+), 3 deletions(-)
+
+diff --git a/Makefile b/Makefile
+index 38629b9e4e59..dce06923dfde 100644
+--- a/Makefile
++++ b/Makefile
+@@ -4,7 +4,7 @@
+ # corresponding CFLAG.
+ #
+ CRYPTODEV_CFLAGS ?= #-DENABLE_ASYNC
+-KBUILD_CFLAGS += -I$(src) $(CRYPTODEV_CFLAGS)
++KBUILD_CFLAGS += -I$(src) $(CRYPTODEV_CFLAGS) -Wvla
+ KERNEL_DIR ?= /lib/modules/$(shell uname -r)/build
+ VERSION = 1.10
+ +diff --git a/authenc.c b/authenc.c
+index 7c236cf6ad34..269b826de70e 100644
+--- a/authenc.c
++++ b/authenc.c
+@@ -312,9 +312,10 @@ static void read_tls_hash(struct scatterlist *dst_sg, int len, void *hash, int h
+       scatterwalk_map_and_copy(hash, dst_sg, len - hash_len, hash_len, 0);
+ }
+ ++#define TLS_MAX_PADDING_SIZE 256
+ static int pad_record(struct scatterlist *dst_sg, int len, int block_size)
+ {
+-      uint8_t pad[block_size];
++      uint8_t pad[TLS_MAX_PADDING_SIZE];
+       int pad_size = block_size - (len % block_size);
+ +     memset(pad, pad_size - 1, pad_size);
+@@ -326,7 +327,7 @@ static int pad_record(struct scatterlist *dst_sg, int len, int block_size) + + static int verify_tls_record_pad(struct scatterlist *dst_sg, int len, int block_size)
+ {
+-      uint8_t pad[256]; /* the maximum allowed */
++      uint8_t pad[TLS_MAX_PADDING_SIZE];
+       uint8_t pad_size;
+       int i;
+ +-- +2.31.1
+
--
2.32.0








-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#13975): 
https://lists.yoctoproject.org/g/meta-arago/message/13975
Mute This Topic: https://lists.yoctoproject.org/mt/92907005/21656
Group Owner: [email protected]
Unsubscribe: https://lists.yoctoproject.org/g/meta-arago/unsub 
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-


Reply via email to