On 26/11/2021 21:15, Christophe JAILLET wrote:
'hisi_hba->slot_index_tags' is a bitmap. So use 'devm_bitmap_zalloc()' to simplify code, improve the semantic and avoid some open-coded arithmetic in allocator arguments. Signed-off-by: Christophe JAILLET<christophe.jaillet@xxxxxxxxxx>
Acked-by: John Garry <john.garry@xxxxxxxxxx>
--- The use of 's' is questionable here. I've left it because it looks more consistent this way with the surrounding code. Can it be an issue to have the length of the allocated bitmap not being a multiple of sizeof(long)?
The driver does not rely on that (allocated bitmap being a multiple of sizeof(long)), but the size is 4096 bits, which would be a multiple of sizeof(long)
Thanks, John
I guess that there is some kind of 'rounding' done by the memory allocator to keep some alignment, so I think that the previous code is safe (but not logical). If this is not the case, there is a potential out of bound bug related to the bitmap API that expect to access only longs (which is not necessarily the case here).