> On Oct 30, 2015, at 5:00 PM, Don Brace <brace77...@gmail.com> wrote:
> On 10/30/2015 03:07 PM, Matthew R. Ochs wrote:
>>> On Oct 28, 2015, at 5:06 PM, Don Brace <don.br...@pmcs.com> wrote:
>>> 
>>> From: Kevin Barnett <kevin.barn...@pmcs.com>
>>> 
>>> Reviewed-by: Scott Teel <scott.t...@pmcs.com>
>>> Reviewed-by: Justin Lindley <justin.lind...@pmcs.com>
>>> Reviewed-by: Kevin Barnett <kevin.barn...@pmcs.com>
>>> Signed-off-by: Don Brace <don.br...@pmcs.com>
>>> ---
>>> drivers/scsi/hpsa.c     |  535 
>>> +++++++++++++++++++++++++++++++++++++++++++++--
>>> drivers/scsi/hpsa.h     |   27 ++
>>> drivers/scsi/hpsa_cmd.h |   14 +
>>> 3 files changed, 555 insertions(+), 21 deletions(-)
>>> 
>>> diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c
>>> index 56526312..ca38a00 100644
>>> --- a/drivers/scsi/hpsa.c
>>> +++ b/drivers/scsi/hpsa.c
>>> @@ -41,6 +41,7 @@
>>> 
>>> +static u64 hpsa_get_sas_address_from_report_physical(struct ctlr_info *h,
>>> +                                           unsigned char *scsi3addr)
>>> +{
>>> +   struct ReportExtendedLUNdata *physdev;
>>> +   u32 nphysicals;
>>> +   u64 sa = 0;
>>> +   int i;
>>> +
>>> +   physdev = kzalloc(sizeof(*physdev), GFP_KERNEL);
>>> +   if (!physdev)
>>> +           return 0;
>>> +
>>> +   if (hpsa_scsi_do_report_phys_luns(h, physdev, sizeof(*physdev))) {
>>> +           dev_err(&h->pdev->dev, "report physical LUNs failed.\n");
>>> +           kfree(physdev);
>>> +           return 0;
>>> +   }
>>> +   nphysicals = get_unaligned_be32(physdev->LUNListLength) / 24;
>>> +
>>> +   for (i = 0; i < nphysicals; i++)
>>> +           if (!memcmp(&physdev->LUN[i].lunid[0], scsi3addr, 8))
>>> +                   sa = get_unaligned_be64(&physdev->LUN[i].wwid[0]);
>> Don't you want to break out here if you found a match?
> Agreed.
>> 
>>> +
>>> +   kfree(physdev);
>>> +
>>> +   return sa;
>>> +}
>>> +
>>> +static void hpsa_get_sas_address(struct ctlr_info *h, unsigned char 
>>> *scsi3addr,
>>> +                                   struct hpsa_scsi_dev_t *dev)
>>> +{
>>> +   int rc;
>>> +   u64 sa = 0;
>>> +
>>> +   if (is_hba_lunid(scsi3addr)) {
>>> +           struct bmic_sense_subsystem_info *ssi;
>>> +
>>> +           ssi = kzalloc(sizeof(*ssi), GFP_KERNEL);
>> What happens if this allocation fails? If the I/O can succeed without the
>> DMA buffer then you will run into trouble when deriving sa.
> Added check for NULL.

With these changes

Reviewed-by: Matthew R. Ochs <mro...@linux.vnet.ibm.com>

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

Reply via email to