From: Dan Carpenter <error27@gmail.com>
To: Jing Huang <huangj@brocade.com>
Cc: "James E.J. Bottomley" <James.Bottomley@suse.de>,
Krishna Gudipati <kgudipat@brocade.com>,
linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org,
kernel-janitors@vger.kernel.org
Subject: [patch] bfa: dereferencing before testing
Date: Sat, 07 Aug 2010 22:13:58 +0000 [thread overview]
Message-ID: <20100807221358.GB9031@bicker> (raw)
I moved the dereference of "port" after the check to verify it was
non-NULL.
Signed-off-by: Dan Carpenter <error27@gmail.com>
diff --git a/drivers/scsi/bfa/lport_api.c b/drivers/scsi/bfa/lport_api.c
index 72b3f50..5cd356a 100644
--- a/drivers/scsi/bfa/lport_api.c
+++ b/drivers/scsi/bfa/lport_api.c
@@ -149,11 +149,12 @@ bfa_fcs_port_get_rport_max_speed(struct bfa_fcs_port_s *port)
enum bfa_pport_speed max_speed = 0;
struct bfa_pport_attr_s pport_attr;
enum bfa_pport_speed pport_speed, rport_speed;
- bfa_boolean_t trl_enabled = bfa_fcport_is_ratelim(port->fcs->bfa);
+ bfa_boolean_t trl_enabled;
if (port = NULL)
return 0;
+ trl_enabled = bfa_fcport_is_ratelim(port->fcs->bfa);
fcs = port->fcs;
/*
WARNING: multiple messages have this Message-ID (diff)
From: Dan Carpenter <error27@gmail.com>
To: Jing Huang <huangj@brocade.com>
Cc: "James E.J. Bottomley" <James.Bottomley@suse.de>,
Krishna Gudipati <kgudipat@brocade.com>,
linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org,
kernel-janitors@vger.kernel.org
Subject: [patch] bfa: dereferencing before testing
Date: Sun, 8 Aug 2010 00:13:58 +0200 [thread overview]
Message-ID: <20100807221358.GB9031@bicker> (raw)
I moved the dereference of "port" after the check to verify it was
non-NULL.
Signed-off-by: Dan Carpenter <error27@gmail.com>
diff --git a/drivers/scsi/bfa/lport_api.c b/drivers/scsi/bfa/lport_api.c
index 72b3f50..5cd356a 100644
--- a/drivers/scsi/bfa/lport_api.c
+++ b/drivers/scsi/bfa/lport_api.c
@@ -149,11 +149,12 @@ bfa_fcs_port_get_rport_max_speed(struct bfa_fcs_port_s *port)
enum bfa_pport_speed max_speed = 0;
struct bfa_pport_attr_s pport_attr;
enum bfa_pport_speed pport_speed, rport_speed;
- bfa_boolean_t trl_enabled = bfa_fcport_is_ratelim(port->fcs->bfa);
+ bfa_boolean_t trl_enabled;
if (port == NULL)
return 0;
+ trl_enabled = bfa_fcport_is_ratelim(port->fcs->bfa);
fcs = port->fcs;
/*
next reply other threads:[~2010-08-07 22:13 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-08-07 22:13 Dan Carpenter [this message]
2010-08-07 22:13 ` [patch] bfa: dereferencing before testing 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=20100807221358.GB9031@bicker \
--to=error27@gmail.com \
--cc=James.Bottomley@suse.de \
--cc=huangj@brocade.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=kgudipat@brocade.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
/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.