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)
committerUlf Hansson <ulf.hansson@linaro.org>
Tue, 12 Jul 2022 10:29:36 +0000 (12:29 +0200)
commit2e531bc3e0d86362fcd8a577b3278d9ef3cc2ba0
tree61cc8fff355d40e4d489ef31876bf56b489f1d8f
parent088604048b24846d1e79da4c2a73a6f3ad43edb4
memstick/ms_block: Fix some incorrect memory allocation

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: 0ab30494bc4f ("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>
drivers/memstick/core/ms_block.c