mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Peter Huewe <peterhuewe@gmx.de>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Devendra Naga <devendra.aaru@gmail.com>,
	Peter Huewe <peterhuewe@gmx.de>,
	Bill Pemberton <wfp5p@virginia.edu>,
	Cruz Julian Bishop <cruzjbishop@gmail.com>,
	devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org
Subject: [PATCH 1/5] staging/slicoss: Check pointer before dereferencing
Date: Tue, 19 Feb 2013 05:13:50 +0100	[thread overview]
Message-ID: <1361247234-1754-1-git-send-email-peterhuewe@gmx.de> (raw)

Smatch complains that the variable adapter is dereferenced before it is
checked:
slicoss.c:906 slic_timer_load_check() warn: variable dereferenced before
check 'adapter' (see line 904)

-> move the assignment after the check.

Signed-off-by: Peter Huewe <peterhuewe@gmx.de>
---
 drivers/staging/slicoss/slicoss.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/slicoss/slicoss.c b/drivers/staging/slicoss/slicoss.c
index 76fc2e5..753993c 100644
--- a/drivers/staging/slicoss/slicoss.c
+++ b/drivers/staging/slicoss/slicoss.c
@@ -901,10 +901,9 @@ static void slic_timer_load_check(ulong cardaddr)
 	u32 load = card->events;
 	u32 level = 0;
 
-	intagg = &adapter->slic_regs->slic_intagg;
-
 	if ((adapter) && (adapter->state == ADAPT_UP) &&
 	    (card->state == CARD_UP) && (slic_global.dynamic_intagg)) {
+		intagg = &adapter->slic_regs->slic_intagg;
 		if (adapter->devid == SLIC_1GB_DEVICE_ID) {
 			if (adapter->linkspeed == LINK_1000MB)
 				level = 100;
-- 
1.7.8.6


             reply	other threads:[~2013-02-19  4:09 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-19  4:13 Peter Huewe [this message]
2013-02-19  4:18 ` [PATCH 2/5] staging/slicoss: Remove always true if statement Peter Huewe
2013-02-19  4:18 ` [PATCH 3/5] staging/slicoss: Fix operation may be undefined warning Peter Huewe
2013-02-19  4:18 ` [PATCH 4/5] staging/slicoss: Fix buffer possible overflow in slic_card_locate Peter Huewe
2013-02-19  4:18 ` [PATCH 5/5] staging/slicoss: Use ether_crc for mac hash calculation Peter Huewe

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=1361247234-1754-1-git-send-email-peterhuewe@gmx.de \
    --to=peterhuewe@gmx.de \
    --cc=cruzjbishop@gmail.com \
    --cc=devel@driverdev.osuosl.org \
    --cc=devendra.aaru@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=wfp5p@virginia.edu \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®