[PATCH] rslib: Add missing includes and update EXPORTs

From: Kees Cook
Date: Tue Apr 24 2018 - 19:00:21 EST


After refactoring to pass down GFP_* flags, slab.h needed to be added and
the EXPORTs needed to be renamed. I also moved some end-of-file EXPORTs
to their respective functions as done already for the other functions in
rslib.

Reported-by: kbuild-all@xxxxxx
Fixes: c80cb2004afe ("rslib: Add GFP aware init function")
Signed-off-by: Kees Cook <keescook@xxxxxxxxxxxx>
Cc: Thomas Gleixner <tglx@xxxxxxxxxxxxx>
---
I added the slab header and fixed up EXPORTs which the same randconfig
noticed at link time after the compile-time failure got fixed.
---
include/linux/rslib.h | 1 +
lib/reed_solomon/reed_solomon.c | 7 +++----
2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/include/linux/rslib.h b/include/linux/rslib.h
index 0ae635bc6d5a..e7d92fae12f3 100644
--- a/include/linux/rslib.h
+++ b/include/linux/rslib.h
@@ -11,6 +11,7 @@
#define _RSLIB_H_

#include <linux/list.h>
+#include <linux/slab.h>

/**
* struct rs_codec - rs codec data
diff --git a/lib/reed_solomon/reed_solomon.c b/lib/reed_solomon/reed_solomon.c
index e705d9877e52..dfcf54242fb9 100644
--- a/lib/reed_solomon/reed_solomon.c
+++ b/lib/reed_solomon/reed_solomon.c
@@ -193,6 +193,7 @@ void free_rs(struct rs_control *rs)
mutex_unlock(&rslistlock);
kfree(rs);
}
+EXPORT_SYMBOL_GPL(free_rs);

/**
* init_rs_internal - Allocate rs control, find a matching codec or allocate a new one
@@ -289,6 +290,7 @@ struct rs_control *init_rs_gfp(int symsize, int gfpoly, int fcr, int prim,
{
return init_rs_internal(symsize, gfpoly, NULL, fcr, prim, nroots, gfp);
}
+EXPORT_SYMBOL_GPL(init_rs_gfp);

/**
* init_rs_non_canonical - Allocate rs control struct for fields with
@@ -308,6 +310,7 @@ struct rs_control *init_rs_non_canonical(int symsize, int (*gffunc)(int),
return init_rs_internal(symsize, 0, gffunc, fcr, prim, nroots,
GFP_KERNEL);
}
+EXPORT_SYMBOL_GPL(init_rs_non_canonical);

#ifdef CONFIG_REED_SOLOMON_ENC8
/**
@@ -411,10 +414,6 @@ int decode_rs16(struct rs_control *rsc, uint16_t *data, uint16_t *par, int len,
EXPORT_SYMBOL_GPL(decode_rs16);
#endif

-EXPORT_SYMBOL_GPL(init_rs);
-EXPORT_SYMBOL_GPL(init_rs_non_canonical);
-EXPORT_SYMBOL_GPL(free_rs);
-
MODULE_LICENSE("GPL");
MODULE_DESCRIPTION("Reed Solomon encoder/decoder");
MODULE_AUTHOR("Phil Karn, Thomas Gleixner");
--
2.7.4


--
Kees Cook
Pixel Security