Skip to content

Commit de24085

Browse files
thenzlmartinkpetersen
authored andcommitted
scsi: mpi3mr: Correct a test in mpi3mr_sas_port_add()
The test for a possible shift overflow is not correct. Fix it by replacing the '>' with a '>='. Signed-off-by: Tomas Henzl <[email protected]> Link: https://lore.kernel.org/r/[email protected] Suggested-by: Dan Carpenter <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
1 parent 06b91c0 commit de24085

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/scsi/mpi3mr/mpi3mr_transport.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1353,7 +1353,7 @@ static struct mpi3mr_sas_port *mpi3mr_sas_port_add(struct mpi3mr_ioc *mrioc,
13531353
mpi3mr_sas_port_sanity_check(mrioc, mr_sas_node,
13541354
mr_sas_port->remote_identify.sas_address, hba_port);
13551355

1356-
if (mr_sas_node->num_phys > sizeof(mr_sas_port->phy_mask) * 8)
1356+
if (mr_sas_node->num_phys >= sizeof(mr_sas_port->phy_mask) * 8)
13571357
ioc_info(mrioc, "max port count %u could be too high\n",
13581358
mr_sas_node->num_phys);
13591359

@@ -1363,7 +1363,7 @@ static struct mpi3mr_sas_port *mpi3mr_sas_port_add(struct mpi3mr_ioc *mrioc,
13631363
(mr_sas_node->phy[i].hba_port != hba_port))
13641364
continue;
13651365

1366-
if (i > sizeof(mr_sas_port->phy_mask) * 8) {
1366+
if (i >= sizeof(mr_sas_port->phy_mask) * 8) {
13671367
ioc_warn(mrioc, "skipping port %u, max allowed value is %lu\n",
13681368
i, sizeof(mr_sas_port->phy_mask) * 8);
13691369
goto out_fail;

0 commit comments

Comments
 (0)