projects
/
platform
/
kernel
/
linux-starfive.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
| inline |
side by side
bcache: avoid oversize memory allocation by small stripe_size
[platform/kernel/linux-starfive.git]
/
drivers
/
md
/
bcache
/
super.c
diff --git
a/drivers/md/bcache/super.c
b/drivers/md/bcache/super.c
index
0ae2b36
..
93791e4
100644
(file)
--- a/
drivers/md/bcache/super.c
+++ b/
drivers/md/bcache/super.c
@@
-905,6
+905,8
@@
static int bcache_device_init(struct bcache_device *d, unsigned int block_size,
if (!d->stripe_size)
d->stripe_size = 1 << 31;
+ else if (d->stripe_size < BCH_MIN_STRIPE_SZ)
+ d->stripe_size = roundup(BCH_MIN_STRIPE_SZ, d->stripe_size);
n = DIV_ROUND_UP_ULL(sectors, d->stripe_size);
if (!n || n > max_stripes) {