Code error in mptsas.c ?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



In mptsas.c there are two functions mptsas_find_phyinfo_by_target and
mptsas_find_phyinfo_by_sas
_address.  Below is the 'by_target' function.  It appears the intent
is to break out of the search when the matching phy_info is found.
However, the 'break' statement will only move to the next 'list' entry
and continue the search.  The 'by_sas_address' function appears to
have the same flaw.  I believe the addition of "if (phy_info) break;"
outside the 'for' loop would correct the functionality.

Can you confirm this?

static struct mptsas_phyinfo *
mptsas_find_phyinfo_by_target(MPT_ADAPTER *ioc, u32 id)
{
        struct mptsas_portinfo *port_info;
        struct mptsas_phyinfo *phy_info = NULL;
        int i;

        mutex_lock(&ioc->sas_topology_mutex);
        list_for_each_entry(port_info, &ioc->sas_topology, list) {
                for (i = 0; i < port_info->num_phys; i++) {
                        if (port_info->phy_info[i].attached.id != id)
                                continue;
                        if (!mptsas_is_end_device(
                                &port_info->phy_info[i].attached))
                                continue;
                        phy_info = &port_info->phy_info[i];
                        break;
                }
        }
        mutex_unlock(&ioc->sas_topology_mutex);
        return phy_info;
}

-Mark G
-
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]
  Powered by Linux