Skip to content
Snippets Groups Projects
Commit e8ff6013 authored by Kees Cook's avatar Kees Cook Committed by Stephen Rothwell
Browse files

exofs-avoid-vla-in-structures-v2

- use DRY for easier to read stripe updates (ndesaulniers)
- add const to unchanging variable (ndesaulniers)
- update references with message-id URLs
- add Reviewed-by

Link: http://lkml.kernel.org/r/20180418163546.GA45794@beast


Signed-off-by: default avatarKees Cook <keescook@chromium.org>
Reviewed-by: default avatarNick Desaulniers <ndesaulniers@google.com>
Cc: Boaz Harrosh <ooo@electrozaur.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarStephen Rothwell <sfr@canb.auug.org.au>
parent 60cd4969
No related branches found
No related tags found
No related merge requests found
......@@ -139,6 +139,8 @@ static int _sp2d_alloc(unsigned pages_in_unit, unsigned group_width,
/* Allocate additionally needed a1pa items in PAGE_SIZE chunks. */
for (i = 0; i < pages_in_unit; ++i) {
struct __1_page_stripe *stripe = &sp2d->_1p_stripes[i];
if (unlikely(__a1pa >= __a1pa_end)) {
num_a1pa = min_t(unsigned, PAGE_SIZE / sizeof__a1pa,
pages_in_unit - i);
......@@ -152,7 +154,7 @@ static int _sp2d_alloc(unsigned pages_in_unit, unsigned group_width,
}
__a1pa_end = __a1pa + alloc_size;
/* First *pages is marked for kfree of the buffer */
sp2d->_1p_stripes[i].alloc = true;
stripe->alloc = true;
}
/*
......@@ -160,11 +162,9 @@ static int _sp2d_alloc(unsigned pages_in_unit, unsigned group_width,
* it which was either part of the original PAGE_SIZE
* allocation or the subsequent allocation in this loop.
*/
sp2d->_1p_stripes[i].pages = (void *)__a1pa;
sp2d->_1p_stripes[i].scribble =
sp2d->_1p_stripes[i].pages + group_width;
sp2d->_1p_stripes[i].page_is_read =
(char *)(sp2d->_1p_stripes[i].scribble + group_width);
stripe->pages = (void *)__a1pa;
stripe->scribble = stripe->pages + group_width;
stripe->page_is_read = (char *)stripe->scribble + group_width;
__a1pa += sizeof__a1pa;
}
......
......@@ -552,7 +552,7 @@ static int __alloc_dev_table(struct exofs_sb_info *sbi, unsigned numdevs,
/* Twice bigger table: See exofs_init_comps() and comment at
* exofs_read_lookup_dev_table()
*/
size_t numores = numdevs * 2 - 1;
const size_t numores = numdevs * 2 - 1;
struct exofs_dev *eds;
unsigned i;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment