lkml.org 
[lkml]   [2021]   [Dec]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH 1/3] scsi: hisi_sas: Use devm_bitmap_zalloc() when applicable
From
Date
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@wanadoo.fr>

Acked-by: John Garry <john.garry@huawei.com>

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

\
 
 \ /
  Last update: 2021-12-06 14:22    [W:0.089 / U:0.704 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site