Hi all,
I enjoyed finding these while testing on a system where I'd forgotten to
enable gcm in the kernel. I.e., these bugs are on error flows, and I
wouldn't expect to encounter them normally.
The Makefile tweak allowed me to select my kernel source, and worked well
for my cross compiling.
Kind regards,
Jaren
diff --git a/Makefile b/Makefile
index bca19ad..362ef95 100644
--- a/Makefile
+++ b/Makefile
@@ -1,5 +1,5 @@
KBUILD_CFLAGS += -I$(src)
-KERNEL_DIR = /lib/modules/$(shell uname -r)/build
+KERNEL_DIR ?= /lib/modules/$(shell uname -r)/build
VERSION = 1.4
cryptodev-objs = ioctl.o main.o cryptlib.o authenc.o zc.o util.o
diff --git a/cryptlib.c b/cryptlib.c
index 4bd073a..f031701 100644
--- a/cryptlib.c
+++ b/cryptlib.c
@@ -93,7 +93,7 @@ int cryptodev_cipher_init(struct cipher_data *out, const
char *alg_name,
ret = crypto_ablkcipher_setkey(out->async.s, keyp, keylen);
} else {
out->async.as = crypto_alloc_aead(alg_name, 0, 0);
- if (unlikely(IS_ERR(out->async.s))) {
+ if (unlikely(IS_ERR(out->async.as))) {
dprintk(1, KERN_DEBUG, "%s: Failed to load cipher
%s\n",
__func__, alg_name);
return -EINVAL;
diff --git a/ioctl.c b/ioctl.c
index 4093960..6e5cc61 100644
--- a/ioctl.c
+++ b/ioctl.c
@@ -464,6 +464,8 @@ cryptodev_open(struct inode *inode, struct file *filp)
for (i = 0; i < DEF_COP_RINGSIZE; i++) {
tmp = kzalloc(sizeof(struct todo_list_item), GFP_KERNEL);
+ if (!tmp)
+ return -ENOMEM;
pcr->itemcount++;
dprintk(2, KERN_DEBUG, "%s: allocated new item at %lx\n",
__func__, (unsigned long)tmp);
_______________________________________________
Cryptodev-linux-devel mailing list
[email protected]
https://mail.gna.org/listinfo/cryptodev-linux-devel