mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 1/5] staging/slicoss: Check pointer before dereferencing
@ 2013-02-19  4:13 Peter Huewe
  2013-02-19  4:18 ` [PATCH 2/5] staging/slicoss: Remove always true if statement Peter Huewe
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Peter Huewe @ 2013-02-19  4:13 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Devendra Naga, Peter Huewe, Bill Pemberton, Cruz Julian Bishop,
	devel, linux-kernel

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


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2013-02-19  4:14 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-02-19  4:13 [PATCH 1/5] staging/slicoss: Check pointer before dereferencing Peter Huewe
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

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®