Skip to content

rslib: Cleanup and VLA removal

Thomas Gleixner kernel-hardening lkml 3 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v3 Latest10 patches 4 repliesIn review
  2. v28 patches 11 repliesSuperseded
  3. v18 patches 6 repliesSuperseded

Patches in v3 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/10rslib: Add GFP aware init functioninclude/linux/rslib.h lib/reed_solomon/reed_solomon.c+43 -193 replies
2/10dm/verity_fec: Use GFP aware reed solomon initdrivers/md/dm-verity-fec.c+1 -10 replies
3/10rslib: Cleanup whitespace damageinclude/linux/rslib.h lib/reed_solomon/reed_solomon.c+12 -120 replies
4/10rslib: Cleanup top level commentsinclude/linux/rslib.h lib/reed_solomon/decode_rs.c lib/reed_solomon/encode_rs.c +1 more+6 -350 replies
5/10rslib: Add SPDX identifiersinclude/linux/rslib.h lib/reed_solomon/decode_rs.c lib/reed_solomon/encode_rs.c +1 more+4 -00 replies
6/10rslib: Remove GPL boilerplateinclude/linux/rslib.h lib/reed_solomon/reed_solomon.c+0 -90 replies
7/10rslib: Simplify error pathlib/reed_solomon/reed_solomon.c+6 -110 replies
8/10rslib: Split rs control structdrivers/mtd/nand/raw/cafe_nand.c drivers/mtd/nand/raw/diskonchip.c include/linux/rslib.h +3 more+100 -700 replies
9/10mtd: rawnand: diskonchip: Allocate rs control per instancedrivers/mtd/nand/raw/diskonchip.c+27 -330 replies
10/10rslib: Allocate decoder buffers to avoid VLAsinclude/linux/rslib.h lib/reed_solomon/decode_rs.c lib/reed_solomon/reed_solomon.c+44 -80 replies

Reviews trailers per patch

5 of 10 patches have a Reviewed-by or Acked-by.

PatchKate StewartGreg Kroah-HartmanBoris BrezillonKees Cook
1/10
2/10
3/10
4/10
5/10R-b R-b
6/10R-b R-b
7/10
8/10A-b
9/10A-b
10/10A-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 4 reviewers.

Read the v3 thread

Cover letter [patch V3 00/10] rslib: Cleanup and VLA removal

Kees tried to get rid of the Variable Length Arrays in the Reed-Solomon library by replacing them with fixed length arrays on stack. Though they are rather large and Andrew did not fall in love with that solution.

This series addresses that in a different way by splitting the rs control structure up, so that each invocation of rs_init() returns a new instance in which the decoder buffers are allocated. The polynom tables which build the base for the RS codecs are still shareable between the instances to avoid large allocations and initializations of the same data over and over.

The usage sites have been audited and fixed up where necessary to accomodate the decoder change which forbids parallel decoder invocation for a particular rs control instance to prevent buffer corruption.

While at it the patch set tidies up the code and converts the related files over to use SPDX license identifiers.

Changes since V2:

Provide a gfp aware variant of init_rs and use it in the alloc callback of the dm/verity_fec rs_pool mempool allocations

Picked up Reviewed/Acked-by tags and fixed the subject line for the MTD specific patch.

Changes since V1:

Simplify error path in the diskonchip code and use the proper function to free the decoder.

As this spawns multiple subsystems it should either go through Andrews tree or Kees can route it with his other hardening stuff.

Thanks,

tglx

8<---------------

 drivers/md/dm-verity-fec.c        |    2 
 drivers/mtd/nand/raw/cafe_nand.c  |    7 -
 drivers/mtd/nand/raw/diskonchip.c |   67 +++++-----
 include/linux/rslib.h             |   71 +++++++----
 lib/reed_solomon/decode_rs.c      |   34 ++---
 lib/reed_solomon/encode_rs.c      |   15 --
 lib/reed_solomon/reed_solomon.c   |  233 ++++++++++++++++++++++----------------
 7 files changed, 237 insertions(+), 192 deletions(-)