From: segooon@gmail.com (Kulikov Vasiliy)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 1/5] arm: mach-davinci: check irq2ctlr() result
Date: Sat, 17 Jul 2010 19:19:07 +0400 [thread overview]
Message-ID: <1279379947-15152-1-git-send-email-segooon@gmail.com> (raw)
If irq2ctlr() fails return IRQ_NONE.
Also as it can fail make 'ctlr' signed.
The semantic patch that finds this problem (many false-positive results):
(http://coccinelle.lip6.fr/)
// <smpl>
@ r1 @
identifier f;
@@
int f(...) { ... }
@@
identifier r1.f;
type T;
unsigned T x;
@@
*x = f(...)
...
*x > 0
Signed-off-by: Kulikov Vasiliy <segooon@gmail.com>
---
arch/arm/mach-davinci/dma.c | 8 ++++++--
1 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/arch/arm/mach-davinci/dma.c b/arch/arm/mach-davinci/dma.c
index d33827a..d1127e1 100644
--- a/arch/arm/mach-davinci/dma.c
+++ b/arch/arm/mach-davinci/dma.c
@@ -344,10 +344,12 @@ static int irq2ctlr(int irq)
static irqreturn_t dma_irq_handler(int irq, void *data)
{
int i;
- unsigned ctlr;
+ int ctlr;
unsigned int cnt = 0;
ctlr = irq2ctlr(irq);
+ if (ctlr < 0)
+ return IRQ_NONE;
dev_dbg(data, "dma_irq_handler\n");
@@ -398,10 +400,12 @@ static irqreturn_t dma_irq_handler(int irq, void *data)
static irqreturn_t dma_ccerr_handler(int irq, void *data)
{
int i;
- unsigned ctlr;
+ int ctlr;
unsigned int cnt = 0;
ctlr = irq2ctlr(irq);
+ if (ctlr < 0)
+ return IRQ_NONE;
dev_dbg(data, "dma_ccerr_handler\n");
--
1.7.0.4
next reply other threads:[~2010-07-17 15:19 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-07-17 15:19 Kulikov Vasiliy [this message]
2010-08-26 18:25 ` [PATCH 1/5] arm: mach-davinci: check irq2ctlr() result Kevin Hilman
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=1279379947-15152-1-git-send-email-segooon@gmail.com \
--to=segooon@gmail.com \
--cc=linux-arm-kernel@lists.infradead.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).