scsi: mpi3mr: Correct a test in mpi3mr_sas_port_add()
BugLink: https://bugs.launchpad.net/bugs/2097393 The test for a possible shift overflow is not correct. Fix it by replacing the '>' with a '>='. Signed-off-by: Tomas Henzl <thenzl@redhat.com> Link: https://lore.kernel.org/r/20240627074827.13672-1-thenzl@redhat.com Suggested-by: Dan Carpenter <dan.carpenter@linaro.org> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com> (cherry picked from commit de24085328c09e5a6dd8a8d95ad65876f097e9c1) [diewald: prerequisite commit for b9e63d6c7c0e9 scsi: mpi3mr: Validate SAS port assignments] Signed-off-by: Manuel Diewald <manuel.diewald@canonical.com> Signed-off-by: Koichiro Den <koichiro.den@canonical.com>
This commit is contained in:
committed by
Mehmet Basaran
parent
03678e17ee
commit
3a2b05ea8a
@@ -1369,7 +1369,7 @@ static struct mpi3mr_sas_port *mpi3mr_sas_port_add(struct mpi3mr_ioc *mrioc,
|
||||
mpi3mr_sas_port_sanity_check(mrioc, mr_sas_node,
|
||||
mr_sas_port->remote_identify.sas_address, hba_port);
|
||||
|
||||
if (mr_sas_node->num_phys > sizeof(mr_sas_port->phy_mask) * 8)
|
||||
if (mr_sas_node->num_phys >= sizeof(mr_sas_port->phy_mask) * 8)
|
||||
ioc_info(mrioc, "max port count %u could be too high\n",
|
||||
mr_sas_node->num_phys);
|
||||
|
||||
@@ -1379,7 +1379,7 @@ static struct mpi3mr_sas_port *mpi3mr_sas_port_add(struct mpi3mr_ioc *mrioc,
|
||||
(mr_sas_node->phy[i].hba_port != hba_port))
|
||||
continue;
|
||||
|
||||
if (i > sizeof(mr_sas_port->phy_mask) * 8) {
|
||||
if (i >= sizeof(mr_sas_port->phy_mask) * 8) {
|
||||
ioc_warn(mrioc, "skipping port %u, max allowed value is %zu\n",
|
||||
i, sizeof(mr_sas_port->phy_mask) * 8);
|
||||
goto out_fail;
|
||||
|
||||
Reference in New Issue
Block a user