]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
scsi: hisi_sas: use safe BITS_PER_BYTE for slot tag size calculation
authorJohn Garry <john.garry@huawei.com>
Tue, 6 Sep 2016 15:36:15 +0000 (23:36 +0800)
committerMartin K. Petersen <martin.petersen@oracle.com>
Wed, 14 Sep 2016 16:54:17 +0000 (12:54 -0400)
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 <john.garry@huawei.com>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/hisi_sas/hisi_sas_main.c

index 0e487517d08efc2e6598794eb8059ef0f55fc972..dcb17a3cbf3fc921407ba3e3eab6c1c5c976e42a 100644 (file)
@@ -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;