Catégorie : Linux

Staging: iio: meter: ade7753: Merged assignment with immediately following return statement

Author: Tina Johnson <tinajohnson.1234@gmail.com> Saved one line of code by merging the assigning and return statements of variable ret. And thus removed variable len which was no longer useful. This patch was done using Coccinelle script and the following semantic patch was used: @@ expression ret; identifier f; @@ -ret = +return f(…); -return ret; …

Lire la suite

Staging: rtl8188eu: os_dep: Compression of lines for immediate return

Author: Vaishali Thakkar <vthakkar1994@gmail.com> This patch compresses two lines in to a single line in file rtw_android.c if immediate return statement is found. It also removes variable bytes_written as it is no longer needed. It is done using script Coccinelle. And coccinelle uses following semantic patch for this compression function: @@ expression ret; identifier f; …

Lire la suite

wil6210: fix PTR_ERR() usage after initialization to constant

Author: Vladimir Kondratiev <qca_vkondrat@qca.qualcomm.com> Reported by coccinelle: tree: git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-next.git master head: 6a5d088a923854569e20eac4f3f569926d5911ec commit: b7cde47009640b88cb3629ee7078a43bc2642459 [18/80] wil6210: convert debugfs to the table mode coccinelle warnings: (new ones prefixed by >>) >> drivers/net/wireless/ath/wil6210/debugfs.c:327:17-24: ERROR: PTR_ERR applied after initialization to constant on line 304 vim +327 drivers/net/wireless/ath/wil6210/debugfs.c 298 struct dentry *dbg, void *base, 299 const struct dbg_off * …

Lire la suite

staging: lustre: lov: expand the GOTO macro

Author: Julia Lawall <Julia.Lawall@lip6.fr> The semantic patch that makes this change is as follows: (http://coccinelle.lip6.fr/) // @@ identifier lbl; identifier rc; constant c; @@ – GOTO(lbl,\(rc\|c\)); + goto lbl; @@ identifier lbl; expression rc; @@ – GOTO(lbl,rc); + rc; + goto lbl; // Signed-off-by: Julia Lawall Signed-off-by: Greg Kroah-Hartman — drivers/staging/lustre/lustre/lov/lov_obd.c | 152 +++++++++++++++——— drivers/staging/lustre/lustre/lov/lov_object.c …

Lire la suite

crypto: memzero_explicit – make sure to clear out sensitive data

Author: Daniel Borkmann <dborkman@redhat.com> Recently, in commit 13aa93c70e71 (« random: add and use memzero_explicit() for clearing data »), we have found that GCC may optimize some memset() cases away when it detects a stack variable is not being used anymore and going out of scope. This can happen, for example, in cases when we are clearing out …

Lire la suite

PCI: Remove assignment from « if » conditions

Author: Quentin Lambert <lambert.quentin@gmail.com> The following Coccinelle semantic patch was used to find and correct cases of assignments in « if » conditions: @@ expression var, expr; statement S; @@ + var = expr; if( – (var = expr) + var ) S Signed-off-by: Quentin Lambert Signed-off-by: Bjorn Helgaas — drivers/pci/hotplug/acpi_pcihp.c | 3 ++- drivers/pci/hotplug/cpci_hotplug_core.c | 9 …

Lire la suite

staging: lustre: obdclass: expand the GOTO macro

Author: Julia Lawall <Julia.Lawall@lip6.fr> The semantic patch that makes this change is as follows: (http://coccinelle.lip6.fr/) // @@ identifier lbl; identifier rc; constant c; @@ – GOTO(lbl,\(rc\|c\)); + goto lbl; @@ identifier lbl; expression rc; @@ – GOTO(lbl,rc); + rc; + goto lbl; // Signed-off-by: Julia Lawall Signed-off-by: Greg Kroah-Hartman — drivers/staging/lustre/lustre/obdclass/acl.c | 27 +++– drivers/staging/lustre/lustre/obdclass/capa.c …

Lire la suite

staging: lustre: obdclass: expand the GOTO macro + break

Author: Julia Lawall <Julia.Lawall@lip6.fr> The semantic patch that makes this change is as follows: (http://coccinelle.lip6.fr/) // @@ identifier lbl,rc,f; constant c; @@ – GOTO(lbl,\(rc\|rc->f\|c\)); – break; + goto lbl; @@ identifier lbl; expression rc; @@ – GOTO(lbl,rc); – break; + rc; + goto lbl; // Signed-off-by: Julia Lawall Signed-off-by: Greg Kroah-Hartman — drivers/staging/lustre/lustre/obdclass/obd_config.c | 16 …

Lire la suite

staging: lustre: obdclass: expand double GOTO macros

Author: Julia Lawall <Julia.Lawall@lip6.fr> The semantic patch that makes this change is as follows: (http://coccinelle.lip6.fr/) // @@ identifier lbl; @@ if (…) GOTO(lbl,…); +else GOTO(lbl,…); @@ identifier lbl; expression e,e1,e2; @@ if (e) – GOTO(lbl,e1); -else GOTO(lbl,e2); + e1; +else e2; +goto lbl; @@ identifier lbl1,lbl2; expression e,e1,e2; @@ + e1=e2; if (e) – GOTO(lbl1,e1=e2); …

Lire la suite

staging: lustre: lvfs: expand the GOTO macro

Author: Julia Lawall <Julia.Lawall@lip6.fr> The semantic patch that makes this change is as follows: (http://coccinelle.lip6.fr/) // @@ identifier lbl; identifier rc; constant c; @@ – GOTO(lbl,\(rc\|c\)); + goto lbl; @@ identifier lbl; expression rc; @@ – GOTO(lbl,rc); + rc; + goto lbl; // Signed-off-by: Julia Lawall Signed-off-by: Greg Kroah-Hartman — drivers/staging/lustre/lustre/lvfs/lvfs_linux.c | 12 ++++++++—- 1 …

Lire la suite