From: John Garry Date: Tue, 6 Sep 2016 15:36:15 +0000 (+0800) Subject: scsi: hisi_sas: use safe BITS_PER_BYTE for slot tag size calculation X-Git-Tag: v4.14-rc1~2270^2~58 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=433f569601402d6b1f0df17b75327aed082680a4;p=platform%2Fkernel%2Flinux-rpi.git scsi: hisi_sas: use safe BITS_PER_BYTE for slot tag size calculation The memory calculation for the tags bitmap should use BITS_PER_BYTE macro instead of coincidental same value of sizeof(unsigned long). Signed-off-by: John Garry Reviewed-by: Hannes Reinecke Signed-off-by: Martin K. Petersen --- diff --git a/drivers/scsi/hisi_sas/hisi_sas_main.c b/drivers/scsi/hisi_sas/hisi_sas_main.c index 0e48751..dcb17a3 100644 --- a/drivers/scsi/hisi_sas/hisi_sas_main.c +++ b/drivers/scsi/hisi_sas/hisi_sas_main.c @@ -1309,7 +1309,7 @@ static int hisi_sas_alloc(struct hisi_hba *hisi_hba, struct Scsi_Host *shost) memset(hisi_hba->breakpoint, 0, s); hisi_hba->slot_index_count = max_command_entries; - s = hisi_hba->slot_index_count / sizeof(unsigned long); + s = hisi_hba->slot_index_count / BITS_PER_BYTE; hisi_hba->slot_index_tags = devm_kzalloc(dev, s, GFP_KERNEL); if (!hisi_hba->slot_index_tags) goto err_out;