All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mike Christie <michaelc@cs.wisc.edu>
To: Tomas Henzl <thenzl@redhat.com>
Cc: "'linux-scsi@vger.kernel.org'" <linux-scsi@vger.kernel.org>,
	vikas.chaudhary@qlogic.com, lalit.chandivade@qlogic.com,
	ravi.anand@qlogic.com
Subject: Re: [PATCH] qla4xx: a small loop fix
Date: Tue, 01 Nov 2011 13:10:50 -0500	[thread overview]
Message-ID: <4EB0362A.3050408@cs.wisc.edu> (raw)
In-Reply-To: <4EB02263.1080603@redhat.com>

On 11/01/2011 11:46 AM, Tomas Henzl wrote:
> From: Tomas Henzl <thenzl@redhat.com>
> 
> When the qla4xxx_get_fwddb_entry returns QLA_ERROR
> the nex_idx is not updated, 
>       for (idx = 0; idx < max_ddbs; idx = next_idx) {
>                 ret = qla4xxx_get_fwddb_entry(ha, idx, NULL, 0, NULL,
>                                               &next_idx, &state, &conn_err,
>                                                 NULL, NULL);
>                 if (ret == QLA_ERROR)
>                         continue;
>  
> This means there is a risk that the 'idx < max_ddbs' condition will never
> met and the loop will loop forever.
> Fix this by explicitly increasing the next_idx in the error condition.
> 
> Maybe a break instead of continue is more appropriate, leaving the decision
> on the qlogic maintainer.
> 
> Signed-off-by: Tomas Henzl <thenzl@redhat.com>
> 
> diff --git a/drivers/scsi/qla4xxx/ql4_init.c b/drivers/scsi/qla4xxx/ql4_init.c
> index 3075fba..17acb17 100644
> --- a/drivers/scsi/qla4xxx/ql4_init.c
> +++ b/drivers/scsi/qla4xxx/ql4_init.c
> @@ -787,8 +787,10 @@ static void qla4xxx_free_ddb_index(struct scsi_qla_host *ha)
>  		ret = qla4xxx_get_fwddb_entry(ha, idx, NULL, 0, NULL,
>  					      &next_idx, &state, &conn_err,
>  						NULL, NULL);
> -		if (ret == QLA_ERROR)
> +		if (ret == QLA_ERROR) {
> +			next_idx++;
>  			continue;
> +		}
>  		if (state == DDB_DS_NO_CONNECTION_ACTIVE ||
>  		    state == DDB_DS_SESSION_FAILED) {
>  			DEBUG2(ql4_printk(KERN_INFO, ha,

Patch looks correct.

James, this is a patch for something that is not yet upstream. I will
just merge this patch with the patch I was going to send upstream, so do
not worry about it.

  reply	other threads:[~2011-11-01 18:05 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-01 16:46 [PATCH] qla4xx: a small loop fix Tomas Henzl
2011-11-01 18:10 ` Mike Christie [this message]
2011-11-01 20:22   ` Tomas Henzl
2011-11-01 20:31     ` Mike Christie

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=4EB0362A.3050408@cs.wisc.edu \
    --to=michaelc@cs.wisc.edu \
    --cc=lalit.chandivade@qlogic.com \
    --cc=linux-scsi@vger.kernel.org \
    --cc=ravi.anand@qlogic.com \
    --cc=thenzl@redhat.com \
    --cc=vikas.chaudhary@qlogic.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.