Re: [PATCH 1/3] scsi: hisi_sas: Use devm_bitmap_zalloc() when applicable

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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).




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]

  Powered by Linux