[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <d1837f2b-2a04-0231-4ccd-1d1118afa595@huawei.com>
Date: Mon, 6 Dec 2021 13:22:13 +0000
From: John Garry <john.garry@...wei.com>
To: Christophe JAILLET <christophe.jaillet@...adoo.fr>,
<jejb@...ux.ibm.com>, <martin.petersen@...cle.com>
CC: <linux-scsi@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
<kernel-janitors@...r.kernel.org>
Subject: Re: [PATCH 1/3] scsi: hisi_sas: Use devm_bitmap_zalloc() when
applicable
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@...adoo.fr>
Acked-by: John Garry <john.garry@...wei.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).
Powered by blists - more mailing lists