All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <error27@gmail.com>
To: Eric Moore <Eric.Moore@lsi.com>
Cc: support@lsi.com, Alexey Dobriyan <adobriyan@gmail.com>,
	James Bottomley <James.Bottomley@suse.de>,
	Kashyap Desai <kashyap.desai@lsi.com>,
	DL-MPTFusionLinux@lsi.com, linux-scsi@vger.kernel.org,
	kernel-janitors@vger.kernel.org
Subject: [patch] fusion: fix error handling of mpt_register()
Date: Fri, 06 Aug 2010 06:34:09 +0000	[thread overview]
Message-ID: <20100806063409.GO9031@bicker> (raw)

mpt_register() returns a positive int between 1 and
MPT_MAX_PROTOCOL_DRIVERS.  It returns MPT_MAX_PROTOCOL_DRIVERS if there
is no slot available.  Most places don't check the return but this is
how it's done in mptctl.c as well.

Signed-off-by: Dan Carpenter <error27@gmail.com>

diff --git a/drivers/message/fusion/mptlan.c b/drivers/message/fusion/mptlan.c
index cbe9607..42affb1 100644
--- a/drivers/message/fusion/mptlan.c
+++ b/drivers/message/fusion/mptlan.c
@@ -1454,7 +1454,7 @@ static int __init mpt_lan_init (void)
 
 	LanCtx = mpt_register(lan_reply, MPTLAN_DRIVER,
 				"lan_reply");
-	if (LanCtx <= 0) {
+	if (LanCtx >= MPT_MAX_PROTOCOL_DRIVERS) {
 		printk (KERN_ERR MYNAM ": Failed to register with MPT base driver\n");
 		return -EBUSY;
 	}

WARNING: multiple messages have this Message-ID (diff)
From: Dan Carpenter <error27@gmail.com>
To: Eric Moore <Eric.Moore@lsi.com>
Cc: support@lsi.com, Alexey Dobriyan <adobriyan@gmail.com>,
	James Bottomley <James.Bottomley@suse.de>,
	Kashyap Desai <kashyap.desai@lsi.com>,
	DL-MPTFusionLinux@lsi.com, linux-scsi@vger.kernel.org,
	kernel-janitors@vger.kernel.org
Subject: [patch] fusion: fix error handling of mpt_register()
Date: Fri, 6 Aug 2010 08:34:09 +0200	[thread overview]
Message-ID: <20100806063409.GO9031@bicker> (raw)

mpt_register() returns a positive int between 1 and
MPT_MAX_PROTOCOL_DRIVERS.  It returns MPT_MAX_PROTOCOL_DRIVERS if there
is no slot available.  Most places don't check the return but this is
how it's done in mptctl.c as well.

Signed-off-by: Dan Carpenter <error27@gmail.com>

diff --git a/drivers/message/fusion/mptlan.c b/drivers/message/fusion/mptlan.c
index cbe9607..42affb1 100644
--- a/drivers/message/fusion/mptlan.c
+++ b/drivers/message/fusion/mptlan.c
@@ -1454,7 +1454,7 @@ static int __init mpt_lan_init (void)
 
 	LanCtx = mpt_register(lan_reply, MPTLAN_DRIVER,
 				"lan_reply");
-	if (LanCtx <= 0) {
+	if (LanCtx >= MPT_MAX_PROTOCOL_DRIVERS) {
 		printk (KERN_ERR MYNAM ": Failed to register with MPT base driver\n");
 		return -EBUSY;
 	}

             reply	other threads:[~2010-08-06  6:34 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-06  6:34 Dan Carpenter [this message]
2010-08-06  6:34 ` [patch] fusion: fix error handling of mpt_register() Dan Carpenter

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=20100806063409.GO9031@bicker \
    --to=error27@gmail.com \
    --cc=DL-MPTFusionLinux@lsi.com \
    --cc=Eric.Moore@lsi.com \
    --cc=James.Bottomley@suse.de \
    --cc=adobriyan@gmail.com \
    --cc=kashyap.desai@lsi.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=support@lsi.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.