* cassini driver: Use of uninitialized memory
@ 2011-08-25 13:58 Thomas Jarosch
2011-08-25 15:02 ` [PATCH] cassini: init before use in cas_interruptN Francois Romieu
0 siblings, 1 reply; 3+ messages in thread
From: Thomas Jarosch @ 2011-08-25 13:58 UTC (permalink / raw)
To: netdev
Hello,
the interrupt routine of the cassini driver
currently looks like this:
----------------------
static irqreturn_t cas_interruptN(int irq, void *dev_id)
{
struct net_device *dev = dev_id;
struct cas *cp = netdev_priv(dev);
unsigned long flags;
int ring;
u32 status = readl(cp->regs + REG_PLUS_INTRN_STATUS(ring));
...
----------------------
-> "ring" isn't initialized properly and gets used
in REG_PLUS_INTRN_STATUS. Some lines below there's this:
----------------------
ring = (irq == cp->pci_irq_INTC) ? 2 : 3;
----------------------
Should that line be moved before the readl() call
or should "ring" be initialized with zero?
Credit for spotting this goes to cppcheck.
Cheers,
Thomas
^ permalink raw reply [flat|nested] 3+ messages in thread* [PATCH] cassini: init before use in cas_interruptN.
2011-08-25 13:58 cassini driver: Use of uninitialized memory Thomas Jarosch
@ 2011-08-25 15:02 ` Francois Romieu
2011-08-26 16:52 ` David Miller
0 siblings, 1 reply; 3+ messages in thread
From: Francois Romieu @ 2011-08-25 15:02 UTC (permalink / raw)
To: Thomas Jarosch; +Cc: netdev, David S. Miller
Signed-off-by: Francois Romieu <romieu@fr.zoreil.com>
Spotted-by: Thomas Jarosch <thomas.jarosch@intra2net.com>
---
David, any opinion regarding the removal of the USE_NAPI #ifdef
in this driver ?
drivers/net/cassini.c | 3 +--
1 files changed, 1 insertions(+), 2 deletions(-)
diff --git a/drivers/net/cassini.c b/drivers/net/cassini.c
index 646c86b..fdb7a17 100644
--- a/drivers/net/cassini.c
+++ b/drivers/net/cassini.c
@@ -2452,14 +2452,13 @@ static irqreturn_t cas_interruptN(int irq, void *dev_id)
struct net_device *dev = dev_id;
struct cas *cp = netdev_priv(dev);
unsigned long flags;
- int ring;
+ int ring = (irq == cp->pci_irq_INTC) ? 2 : 3;
u32 status = readl(cp->regs + REG_PLUS_INTRN_STATUS(ring));
/* check for shared irq */
if (status == 0)
return IRQ_NONE;
- ring = (irq == cp->pci_irq_INTC) ? 2 : 3;
spin_lock_irqsave(&cp->lock, flags);
if (status & INTR_RX_DONE_ALT) { /* handle rx separately */
#ifdef USE_NAPI
--
1.7.4.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2011-08-26 16:52 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-08-25 13:58 cassini driver: Use of uninitialized memory Thomas Jarosch
2011-08-25 15:02 ` [PATCH] cassini: init before use in cas_interruptN Francois Romieu
2011-08-26 16:52 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox