From: Julia Lawall <hidden> Date: 2017-07-15 20:34:47
These patches fix cases where there is a static on a local variable, but
the variable is initialized before any possible use. Thus, the static has
no benefit.
---
drivers/ata/sata_gemini.c | 2 +-
drivers/clk/clk-moxart.c | 4 ++--
drivers/clk/mmp/clk.c | 2 +-
drivers/iio/orientation/hid-sensor-rotation.c | 2 +-
drivers/irqchip/irq-digicolor.c | 2 +-
drivers/irqchip/irq-gic-realview.c | 2 +-
drivers/irqchip/irq-mips-cpu.c | 2 +-
drivers/mfd/max8925-i2c.c | 2 +-
drivers/mfd/twl4030-irq.c | 2 +-
drivers/mtd/maps/physmap_of_versatile.c | 2 +-
drivers/video/fbdev/da8xx-fb.c | 2 +-
11 files changed, 12 insertions(+), 12 deletions(-)
From: Julia Lawall <hidden> Date: 2017-07-15 20:32:56
Drop static on a local variable, when the variable is initialized before
any possible use. Thus, the static has no benefit.
The semantic patch that fixes this problem is as follows:
(http://coccinelle.lip6.fr/)
// <smpl>
@bad exists@
position p;
identifier x;
type T;
@@
static T x@p;
...
x = <+...x...+>
@@
identifier x;
expression e;
type T;
position p != bad.p;
@@
-static
T x@p;
... when != x
when strict
?x = e;
// </smpl>
Signed-off-by: Julia Lawall <redacted>
---
These patches are all independent of each other.
drivers/iio/orientation/hid-sensor-rotation.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff -u -p a/drivers/iio/orientation/hid-sensor-rotation.c b/drivers/iio/orientation/hid-sensor-rotation.c
From: Joe Perches <joe@perches.com> Date: 2017-07-15 20:38:06
On Sat, 2017-07-15 at 22:07 +0200, Julia Lawall wrote:
These patches fix cases where there is a static on a local variable, but
the variable is initialized before any possible use. Thus, the static has
no benefit.
From: Julia Lawall <hidden> Date: 2017-07-15 21:00:42
On Sat, 15 Jul 2017, Joe Perches wrote:
On Sat, 2017-07-15 at 22:07 +0200, Julia Lawall wrote:
quoted
These patches fix cases where there is a static on a local variable, but
the variable is initialized before any possible use. Thus, the static has
no benefit.
Nice one.
Thanks. It was suggested by Kees Cook a while ago. There seem to be many
opportunities.
julia
From: Jonathan Cameron <jic23@kernel.org> Date: 2017-07-17 20:45:40
On Sat, 15 Jul 2017 22:07:44 +0200
Julia Lawall [off-list ref] wrote:
Drop static on a local variable, when the variable is initialized before
any possible use. Thus, the static has no benefit.
The semantic patch that fixes this problem is as follows:
(http://coccinelle.lip6.fr/)
// <smpl>
@bad exists@
position p;
identifier x;
type T;
@@
static T x@p;
...
x = <+...x...+>
@@
identifier x;
expression e;
type T;
position p != bad.p;
@@
-static
T x@p;
... when != x
when strict
?x = e;
// </smpl>
Signed-off-by: Julia Lawall <redacted>
Applied to the togreg branch of iio.git and pushed out
as testing for the autobuilders to play with it.
Thanks,
Jonathan
quoted hunk
---
These patches are all independent of each other.
drivers/iio/orientation/hid-sensor-rotation.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff -u -p a/drivers/iio/orientation/hid-sensor-rotation.c b/drivers/iio/orientation/hid-sensor-rotation.c