From: James Smart <James.Smart@Emulex.Com>
To: Joe Eykholt <jeykholt@cisco.com>
Cc: Roel Kluin <roel.kluin@gmail.com>,
"linux-scsi@vger.kernel.org" <linux-scsi@vger.kernel.org>,
Andrew Morton <akpm@linux-foundation.org>
Subject: Re: [PATCH] lpfc: Read buffer overflow
Date: Tue, 4 Aug 2009 09:29:35 -0400 [thread overview]
Message-ID: <4A7837BF.2090000@emulex.com> (raw)
In-Reply-To: <4A771B2A.9050307@cisco.com>
Ok - it's good practice. But really, it's change for change sake, rather than
fixing any problem.
-- james s
Joe Eykholt wrote:
> James Smart wrote:
>> NACK - the vports array is created such that it is sized for
>> phba->max_vports + 1.
>
> It's not an off-by-one problem, it's a look-before-leaping problem.
>
> Regards,
> Joe
>
>> -- james s
>>
>> Roel Kluin wrote:
>>> Check whether index is within bounds before testing the element.
>>>
>>> Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
>>> ---
>>> diff --git a/drivers/scsi/lpfc/lpfc_vport.c
>>> b/drivers/scsi/lpfc/lpfc_vport.c
>>> index e0b4992..ade2df6 100644
>>> --- a/drivers/scsi/lpfc/lpfc_vport.c
>>> +++ b/drivers/scsi/lpfc/lpfc_vport.c
>>> @@ -762,7 +762,7 @@ lpfc_destroy_vport_work_array(struct lpfc_hba
>>> *phba, struct lpfc_vport **vports)
>>> int i;
>>> if (vports == NULL)
>>> return;
>>> - for (i = 0; vports[i] != NULL && i <= phba->max_vports; i++)
>>> + for (i = 0; i <= phba->max_vports && vports[i] != NULL; i++)
>>> scsi_host_put(lpfc_shost_from_vport(vports[i]));
>>> kfree(vports);
>>> }
>>>
>>>
>> --
>> To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
>
next prev parent reply other threads:[~2009-08-04 14:08 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-08-02 8:08 [PATCH] lpfc: Read buffer overflow Roel Kluin
2009-08-03 15:02 ` James Smart
2009-08-03 17:15 ` Joe Eykholt
2009-08-04 13:29 ` James Smart [this message]
2009-08-03 23:42 ` Andrew Morton
2009-08-04 0:31 ` James Bottomley
2009-08-04 13:39 ` James Smart
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4A7837BF.2090000@emulex.com \
--to=james.smart@emulex.com \
--cc=akpm@linux-foundation.org \
--cc=jeykholt@cisco.com \
--cc=linux-scsi@vger.kernel.org \
--cc=roel.kluin@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.