diff options
author | Thomas Gleixner <tglx@linutronix.de> | 2018-04-22 18:23:53 +0200 |
---|---|---|
committer | Kees Cook <keescook@chromium.org> | 2018-04-25 04:50:08 +0200 |
commit | 2163398192f6a53e84765cfe3e5a2088437c3d2d (patch) | |
tree | 48499f82bbc91035912dc0977a8dae191141e39e /lib/reed_solomon/decode_rs.c | |
parent | rslib: Simplify error path (diff) | |
download | linux-2163398192f6a53e84765cfe3e5a2088437c3d2d.tar.xz linux-2163398192f6a53e84765cfe3e5a2088437c3d2d.zip |
rslib: Split rs control struct
The decoder library uses variable length arrays on stack. To get rid of
them it would be simple to allocate fixed length arrays on stack, but those
might become rather large. The other solution is to allocate the buffers in
the rs control structure, but this cannot be done as long as the structure
can be shared by several users. Sharing is desired because the RS polynom
tables are large and initialization is time consuming.
To solve this split the codec information out of the control structure and
have a pointer to a shared codec in it. Instantiate the control structure
for each user, create a new codec if no shareable is avaiable yet. Adjust
all affected usage sites to the new scheme.
This allows to add per instance decoder buffers to the control structure
later on.
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Acked-by: Boris Brezillon <boris.brezillon@bootlin.com>
Cc: Tony Luck <tony.luck@intel.com>
Cc: Kees Cook <keescook@chromium.org>
Cc: Segher Boessenkool <segher@kernel.crashing.org>
Cc: Kernel Hardening <kernel-hardening@lists.openwall.com>
Cc: Richard Weinberger <richard@nod.at>
Cc: Mike Snitzer <snitzer@redhat.com>
Cc: Anton Vorontsov <anton@enomsg.org>
Cc: Colin Cross <ccross@android.com>
Cc: Andrew Morton <akpm@linuxfoundation.org>
Cc: David Woodhouse <dwmw2@infradead.org>
Cc: Alasdair Kergon <agk@redhat.com>
Signed-off-by: Kees Cook <keescook@chromium.org>
Diffstat (limited to 'lib/reed_solomon/decode_rs.c')
-rw-r--r-- | lib/reed_solomon/decode_rs.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/lib/reed_solomon/decode_rs.c b/lib/reed_solomon/decode_rs.c index d61007ade4a0..794cced31c75 100644 --- a/lib/reed_solomon/decode_rs.c +++ b/lib/reed_solomon/decode_rs.c @@ -10,6 +10,7 @@ * Generic data width independent code which is included by the wrappers. */ { + struct rs_codec *rs = rsc->codec; int deg_lambda, el, deg_omega; int i, j, r, k, pad; int nn = rs->nn; |