From: der.herr@hofr.at (Nicholas Mc Guire)
To: cocci@systeme.lip6.fr
Subject: [Cocci] [PATCH] scripts: coccinelle: kfree with TRACE_RET before ref is ok (resent)
Date: Tue, 22 Jul 2014 12:12:17 +0200 [thread overview]
Message-ID: <20140722101217.GA16183@opentech.at> (raw)
kfree.cocci currently triggers on constructs like
(resending with proper CC list and subject line)
drivers/staging/rts5208/spi.c
596 if (retval < 0) {
597 kfree(buf);
598 rtsx_clear_spi_error(chip);
599 spi_set_err_code(chip, SPI_HW_ERR);
600 TRACE_RET(chip, STATUS_FAIL);
601 }
602
603 rtsx_stor_access_xfer_buf(buf, pagelen, srb, &index, &offset,
TO_XFER_BUF);
with:
./drivers/staging/rts5208/spi.c:603:28-31: ERROR: reference preceded
by free on line 597
but this should be fine - so TRACE_RET is added to the list of calls
"protecting" access to freed objects see drivers/staging/rts5208/trace.h
Acked-by: Julia Lawall <julia.lawall@lip6.fr>
Signed-off-by: Nicholas Mc Guire <der.herr@hofr.at>
---
scripts/coccinelle/free/kfree.cocci | 2 ++
1 file changed, 2 insertions(+)
diff --git a/scripts/coccinelle/free/kfree.cocci b/scripts/coccinelle/free/kfree.cocci
index 577b780..04d3f4f 100644
--- a/scripts/coccinelle/free/kfree.cocci
+++ b/scripts/coccinelle/free/kfree.cocci
@@ -101,6 +101,8 @@ kfree at p1(E,...)
|
return_ACPI_STATUS(...)
|
+ TRACE_RET(...)
+|
E at p2 // bad use
)
--
1.7.10.4
WARNING: multiple messages have this Message-ID (diff)
From: Nicholas Mc Guire <der.herr@hofr.at>
To: Michal Marek <mmarek@suse.cz>
Cc: Julia Lawall <Julia.Lawall@lip6.fr>,
Gilles Muller <Gilles.Muller@lip6.fr>,
Nicolas Palix <nicolas.palix@imag.fr>,
cocci@systeme.lip6.fr, linux-kernel@vger.kernel.org
Subject: [PATCH] scripts: coccinelle: kfree with TRACE_RET before ref is ok (resent)
Date: Tue, 22 Jul 2014 12:12:17 +0200 [thread overview]
Message-ID: <20140722101217.GA16183@opentech.at> (raw)
kfree.cocci currently triggers on constructs like
(resending with proper CC list and subject line)
drivers/staging/rts5208/spi.c
596 if (retval < 0) {
597 kfree(buf);
598 rtsx_clear_spi_error(chip);
599 spi_set_err_code(chip, SPI_HW_ERR);
600 TRACE_RET(chip, STATUS_FAIL);
601 }
602
603 rtsx_stor_access_xfer_buf(buf, pagelen, srb, &index, &offset,
TO_XFER_BUF);
with:
./drivers/staging/rts5208/spi.c:603:28-31: ERROR: reference preceded
by free on line 597
but this should be fine - so TRACE_RET is added to the list of calls
"protecting" access to freed objects see drivers/staging/rts5208/trace.h
Acked-by: Julia Lawall <julia.lawall@lip6.fr>
Signed-off-by: Nicholas Mc Guire <der.herr@hofr.at>
---
scripts/coccinelle/free/kfree.cocci | 2 ++
1 file changed, 2 insertions(+)
diff --git a/scripts/coccinelle/free/kfree.cocci b/scripts/coccinelle/free/kfree.cocci
index 577b780..04d3f4f 100644
--- a/scripts/coccinelle/free/kfree.cocci
+++ b/scripts/coccinelle/free/kfree.cocci
@@ -101,6 +101,8 @@ kfree@p1(E,...)
|
return_ACPI_STATUS(...)
|
+ TRACE_RET(...)
+|
E@p2 // bad use
)
--
1.7.10.4
next reply other threads:[~2014-07-22 10:12 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-07-22 10:12 Nicholas Mc Guire [this message]
2014-07-22 10:12 ` [PATCH] scripts: coccinelle: kfree with TRACE_RET before ref is ok (resent) Nicholas Mc Guire
2014-07-22 13:51 ` [Cocci] " Bjørn Mork
2014-07-22 13:51 ` Bjørn Mork
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=20140722101217.GA16183@opentech.at \
--to=der.herr@hofr.at \
--cc=cocci@systeme.lip6.fr \
/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.