regmap: cache: rbtree: use krealloc_array() to replace krealloc()
Subsystems (2)
PATCH 1/1 regmap: cache: rbtree: use krealloc_array() to replace krealloc()
Use krealloc_array() to replace krealloc() with multiplication. krealloc_array() has multiply overflow check, which will be safer.
--- drivers/base/regmap/regcache-rbtree.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-)
drivers/base/regmap/regcache-rbtree.c +4 -6
@@ -275,18 +275,16 @@ static int regcache_rbtree_insert_to_block(struct regmap *map, pos = (reg - base_reg) / map->reg_stride; offset = (rbnode->base_reg - base_reg) / map->reg_stride; - blk =krealloc (rbnode->block, - blklen * map->cache_word_size, - map->alloc_flags); + blk =krealloc_array (rbnode->block, blklen, map->cache_word_size, map->alloc_flags);if (!blk)return -ENOMEM ; rbnode->block = blk;if (BITS_TO_LONGS (blklen) >BITS_TO_LONGS (rbnode->blklen)) { - present =krealloc (rbnode->cache_present, -BITS_TO_LONGS (blklen) *sizeof (*present), - map->alloc_flags); + present =krealloc_array (rbnode->cache_present, +BITS_TO_LONGS (blklen),sizeof (*present), + map->alloc_flags);if (!present)return -ENOMEM ;
Signature · 1 line
2.43.0.rc1.1336.g36b5255a03ac
Mark Brown
maintainerQuoted 4 lines · Andy Shevchenko
Use
krealloc_array()to replacekrealloc()with multiplication.krealloc_array()has multiply overflow check, which will be safer.
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/regmap.git for-next
Thanks!
[1/1] regmap: cache: rbtree: use krealloc_array() to replace krealloc()
commit: b95cacd8d708bce5839db2767d425e20ae548fd8
All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying to this mail.
Thanks,
Mark