From: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>
To: cocci@inria.fr
Subject: [cocci] Spatch corrupting struct variable
Date: Thu, 21 Dec 2023 10:44:58 +0200 (EET) [thread overview]
Message-ID: <db0e2b-9ddd-542d-5a59-ed15ffd594b8@linux.intel.com> (raw)
Hi all,
I'm at total loss what coccinelle/spatch is trying to do here:
@@
struct resource *res;
expression size;
@@
- res->end = res->start + size - 1;
+ resource_set_size(res, size);
Spatching against Linux kernel tree results in this corruption:
HANDLING: drivers/bus/fsl-mc/fsl-mc-bus.c
diff =
diff -u -p a/fsl-mc-bus.c b/fsl-mc-bus.c
--- a/fsl-mc-bus.c
+++ b/fsl-mc-bus.c
@@ -736,7 +736,7 @@ static int fsl_mc_device_get_mmio_region
goto error_cleanup_regions;
}
- regions[i].end = regions[i].start + region_desc.size - 1;
+ resource_set_size(regions, region_desc.size);
regions[i].name = "fsl-mc object MMIO region";
regions[i].flags = region_desc.flags & IORESOURCE_BITS;
regions[i].flags |= IORESOURCE_MEM;
??? How did that [i] vanish from regions? Why spatch thought . and -> are
equal?
$ spatch --version
spatch version 1.1.0 compiled with OCaml version 4.11.1
Flags passed to the configure script: --prefix=/usr --sysconfdir=/etc --libdir=/usr/lib --enable-ocaml --enable-python --enable-opt
OCaml scripting support: yes
Python scripting support: yes
Syntax of regular expressions: PCRE
--
i.
next reply other threads:[~2023-12-21 8:55 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-12-21 8:44 Ilpo Järvinen [this message]
2023-12-21 9:01 ` [cocci] Spatch corrupting struct variable Julia Lawall
2023-12-21 9:44 ` Ilpo Järvinen
2023-12-21 11:16 ` [cocci] Transforming data structure accesses with SmPL Markus Elfring
[not found] ` <80d307c-e3f7-8f84-78d4-b19113f441f7@linux.intel.com>
2023-12-21 12:52 ` Markus Elfring
2023-12-21 12:57 ` Julia Lawall
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=db0e2b-9ddd-542d-5a59-ed15ffd594b8@linux.intel.com \
--to=ilpo.jarvinen@linux.intel.com \
--cc=cocci@inria.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 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 read-only IMAP folder(s) and NNTP newsgroup(s).