]> git.baikalelectronics.ru Git - kernel.git/commit
memstick/ms_block: Fix some incorrect memory allocation
authorChristophe JAILLET <christophe.jaillet@wanadoo.fr>
Sat, 25 Jun 2022 12:55:25 +0000 (14:55 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 25 Aug 2022 09:17:55 +0000 (11:17 +0200)
commit7a11e277c7289c43578d7dda041bab5b1f96c308
tree5671cef22a6533aa063bbbff9d77fb98fdb2dc84
parentf551b38c7cfd5a1f86401258f9a90f6f806078aa
memstick/ms_block: Fix some incorrect memory allocation

[ Upstream commit aa15913163e91df46425c4a818a6df546edce6fb ]

Some functions of the bitmap API take advantage of the fact that a bitmap
is an array of long.

So, to make sure this assertion is correct, allocate bitmaps with
bitmap_zalloc() instead of kzalloc()+hand-computed number of bytes.

While at it, also use bitmap_free() instead of kfree() to keep the
semantic.

Fixes: f5fd04826d7e ("memstick: add support for legacy memorysticks")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Link: https://lore.kernel.org/r/dbf633c48c24ae6d95f852557e8d8b3bbdef65fe.1656155715.git.christophe.jaillet@wanadoo.fr
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/memstick/core/ms_block.c