<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux/scripts/coccinelle/api, branch v6.8</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/
</subtitle>
<id>https://git.shady.money/linux/atom?h=v6.8</id>
<link rel='self' href='https://git.shady.money/linux/atom?h=v6.8'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/'/>
<updated>2024-01-20T20:56:11Z</updated>
<entry>
<title>coccinelle: device_attr_show: simplify patch case</title>
<updated>2024-01-20T20:56:11Z</updated>
<author>
<name>Julia Lawall</name>
<email>Julia.Lawall@inria.fr</email>
</author>
<published>2024-01-20T20:56:11Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=ff82e84e80fc0c93095f5a36e0a3508ac121ab80'/>
<id>urn:sha1:ff82e84e80fc0c93095f5a36e0a3508ac121ab80</id>
<content type='text'>
Replacing the final expression argument by ... allows the format
string to have multiple arguments.

It also has the advantage of allowing the change to be recognized as
a change in a single statement, thus avoiding adding unneeded braces.

Signed-off-by: Julia Lawall &lt;Julia.Lawall@inria.fr&gt;
</content>
</entry>
<entry>
<title>coccinelle: device_attr_show: Adapt to the latest Documentation/filesystems/sysfs.rst</title>
<updated>2024-01-19T20:52:09Z</updated>
<author>
<name>Li Zhijian</name>
<email>lizhijian@fujitsu.com</email>
</author>
<published>2024-01-19T06:20:57Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=68ea60a7961ca6c7c38f856572a146f66949815d'/>
<id>urn:sha1:68ea60a7961ca6c7c38f856572a146f66949815d</id>
<content type='text'>
Adapt description, warning message and MODE=patch according to the latest
Documentation/filesystems/sysfs.rst:
&gt; show() should only use sysfs_emit() or sysfs_emit_at() when formatting
&gt; the value to be returned to user space.

After this patch:
When MODE=report,
 $ make coccicheck COCCI=scripts/coccinelle/api/device_attr_show.cocci M=drivers/hid/hid-picolcd_core.c MODE=report
 &lt;...snip...&gt;
 drivers/hid/hid-picolcd_core.c:304:8-16: WARNING: please use sysfs_emit or sysfs_emit_at
 drivers/hid/hid-picolcd_core.c:259:9-17: WARNING: please use sysfs_emit or sysfs_emit_at

When MODE=patch,
 $ make coccicheck COCCI=scripts/coccinelle/api/device_attr_show.cocci M=drivers/hid/hid-picolcd_core.c MODE=patch
 &lt;...snip...&gt;
 diff -u -p a/drivers/hid/hid-picolcd_core.c b/drivers/hid/hid-picolcd_core.c
 --- a/drivers/hid/hid-picolcd_core.c
 +++ b/drivers/hid/hid-picolcd_core.c
 @@ -255,10 +255,12 @@ static ssize_t picolcd_operation_mode_sh
  {
         struct picolcd_data *data = dev_get_drvdata(dev);

 -       if (data-&gt;status &amp; PICOLCD_BOOTLOADER)
 -               return snprintf(buf, PAGE_SIZE, "[bootloader] lcd\n");
 -       else
 -               return snprintf(buf, PAGE_SIZE, "bootloader [lcd]\n");
 +       if (data-&gt;status &amp; PICOLCD_BOOTLOADER) {
 +               return sysfs_emit(buf, "[bootloader] lcd\n");
 +       }
 +       else {
 +               return sysfs_emit(buf, "bootloader [lcd]\n");
 +       }
  }

  static ssize_t picolcd_operation_mode_store(struct device *dev,
 @@ -301,7 +303,7 @@ static ssize_t picolcd_operation_mode_de
  {
         struct picolcd_data *data = dev_get_drvdata(dev);

 -       return snprintf(buf, PAGE_SIZE, "hello world\n");
 +       return sysfs_emit(buf, "hello world\n");
  }

  static ssize_t picolcd_operation_mode_delay_store(struct device *dev,

CC: Julia Lawall &lt;Julia.Lawall@inria.fr&gt;
CC: Nicolas Palix &lt;nicolas.palix@imag.fr&gt;
CC: cocci@inria.fr
Signed-off-by: Li Zhijian &lt;lizhijian@fujitsu.com&gt;
</content>
</entry>
<entry>
<title>Revert "debugfs, coccinelle: check for obsolete DEFINE_SIMPLE_ATTRIBUTE() usage"</title>
<updated>2023-07-29T15:05:31Z</updated>
<author>
<name>Sean Christopherson</name>
<email>seanjc@google.com</email>
</author>
<published>2023-07-26T20:29:20Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=880218361c10d6dd7f99423d621112b8770fc32f'/>
<id>urn:sha1:880218361c10d6dd7f99423d621112b8770fc32f</id>
<content type='text'>
Remove coccinelle's recommendation to use DEFINE_DEBUGFS_ATTRIBUTE()
instead of DEFINE_SIMPLE_ATTRIBUTE().  Regardless of whether or not the
"significant overhead" incurred by debugfs_create_file() is actually
meaningful, warnings from the script have led to a rash of low-quality
patches that have sowed confusion and consumed maintainer time for little
to no benefit.  There have been no less than four attempts to "fix" KVM,
and a quick search on lore shows that KVM is not alone.

This reverts commit 5103068eaca290f890a30aae70085fac44cecaf6.

Link: https://lore.kernel.org/all/87tu2nbnz3.fsf@mpe.ellerman.id.au
Link: https://lore.kernel.org/all/c0b98151-16b6-6d8f-1765-0f7d46682d60@redhat.com
Link: https://lkml.kernel.org/r/20230706072954.4881-1-duminjie%40vivo.com
Link: https://lore.kernel.org/all/Y2FsbufV00jbyF0B@google.com
Link: https://lore.kernel.org/all/Y2ENJJ1YiSg5oHiy@orome
Link: https://lore.kernel.org/all/7560b350e7b23786ce712118a9a504356ff1cca4.camel@kernel.org
Suggested-by: Paolo Bonzini &lt;pbonzini@redhat.com&gt;
Acked-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
Signed-off-by: Sean Christopherson &lt;seanjc@google.com&gt;
Message-Id: &lt;20230726202920.507756-1-seanjc@google.com&gt;
Signed-off-by: Paolo Bonzini &lt;pbonzini@redhat.com&gt;
</content>
</entry>
<entry>
<title>coccinelle: api/atomic_as_refcounter: include message type in output</title>
<updated>2022-12-26T20:47:12Z</updated>
<author>
<name>Deepak R Varma</name>
<email>drv@mailo.com</email>
</author>
<published>2022-12-26T11:40:48Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=bab550371cb13fe7adc4105a57d0530565740fc6'/>
<id>urn:sha1:bab550371cb13fe7adc4105a57d0530565740fc6</id>
<content type='text'>
A common practice is to grep for "WARNING" or "ERROR" text in the report
output from a Coccinelle semantic patch script. So, include the text
"WARNING: " in the report output generated by the semantic patch for
desired filtering of the output. Also improves the readability of the
output. Here is an example of the old and new outputs reported:

    xyz_file.c:131:39-40: atomic_add_unless
    xyz_file.c:131:39-40: WARNING: atomic_add_unless

    xyz_file.c:196:6-25: atomic_dec_and_test variation before object free at line 208.
    xyz_file.c:196:6-25: WARNING: atomic_dec_and_test variation before object free at line 208.

Signed-off-by: Deepak R Varma &lt;drv@mailo.com&gt;
Acked-by: Julia Lawall &lt;Julia.Lawall@inria.fr&gt;
</content>
</entry>
<entry>
<title>update Coccinelle URL</title>
<updated>2022-08-07T19:30:36Z</updated>
<author>
<name>Julia Lawall</name>
<email>Julia.Lawall@inria.fr</email>
</author>
<published>2022-08-07T16:19:54Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=f01701cec8cbb94df209e9705b97abd01c151ba1'/>
<id>urn:sha1:f01701cec8cbb94df209e9705b97abd01c151ba1</id>
<content type='text'>
Signed-off-by: Julia Lawall &lt;Julia.Lawall@inria.fr&gt;
</content>
</entry>
<entry>
<title>coccinelle: api: rename kzfree to kfree_sensitive</title>
<updated>2021-08-05T11:01:09Z</updated>
<author>
<name>Weizhao Ouyang</name>
<email>o451686892@gmail.com</email>
</author>
<published>2021-08-05T09:58:23Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=9eec0792024983276871baeb201609abb07dd35d'/>
<id>urn:sha1:9eec0792024983276871baeb201609abb07dd35d</id>
<content type='text'>
Commit 453431a54934 ("mm, treewide: rename kzfree() to
kfree_sensitive()") renamed kzfree() to kfree_sensitive(),
it should be applied to coccinelle.

Signed-off-by: Weizhao Ouyang &lt;o451686892@gmail.com&gt;
Signed-off-by: Julia Lawall &lt;Julia.Lawall@inria.fr&gt;
Acked-by: Denis Efremov &lt;efremov@linux.com&gt;
</content>
</entry>
<entry>
<title>coccinelle: api: remove kobj_to_dev.cocci script</title>
<updated>2021-06-21T18:45:49Z</updated>
<author>
<name>Keith Busch</name>
<email>kbusch@kernel.org</email>
</author>
<published>2021-06-21T17:48:08Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=5e5234462756a39e56f4182694f47ec72b5abe52'/>
<id>urn:sha1:5e5234462756a39e56f4182694f47ec72b5abe52</id>
<content type='text'>
Using kobj_to_dev() instead of container_of() is not universally
accepted among maintainers as an improvement. The warning leads to
repeated patch submissions that won't be accepted. Remove the script.

Cc: Christoph Hellwig &lt;hch@lst.de&gt;
Cc: Jens Axboe &lt;axboe@kernel.dk&gt;
Cc: Denis Efremov &lt;efremov@linux.com&gt;
Cc: Julia Lawall &lt;Julia.Lawall@inria.fr&gt;
Signed-off-by: Keith Busch &lt;kbusch@kernel.org&gt;
Signed-off-by: Julia Lawall &lt;Julia.Lawall@inria.fr&gt;
Acked-by: Jens Axboe &lt;axboe@kernel.dk&gt;
Acked-by: Denis Efremov &lt;efremov@linux.com&gt;
</content>
</entry>
<entry>
<title>coccinnelle: Remove ptr_ret script</title>
<updated>2020-12-15T19:55:19Z</updated>
<author>
<name>Maxime Ripard</name>
<email>maxime@cerno.tech</email>
</author>
<published>2020-12-15T12:24:59Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=b784c77075023e1a71bc06e6b4f711acb99e9c73'/>
<id>urn:sha1:b784c77075023e1a71bc06e6b4f711acb99e9c73</id>
<content type='text'>
The ptr_ret script script addresses a number of situations where we end up
testing an error pointer, and if it's an error returning it, or return 0
otherwise to transform it into a PTR_ERR_OR_ZERO call.

So it will convert a block like this:

if (IS_ERR(err))
    return PTR_ERR(err);

return 0;

into

return PTR_ERR_OR_ZERO(err);

While this is technically correct, it has a number of drawbacks. First, it
merges the error and success path, which will make it harder for a reviewer
or reader to grasp.

It's also more difficult to extend if we were to add some code between the
error check and the function return, making the author essentially revert
that patch before adding new lines, while it would have been a trivial
addition otherwise for the rewiever.

Therefore, since that script is only about cosmetic in the first place,
let's remove it since it's not worth it.

Acked-by: Jani Nikula &lt;jani.nikula@intel.com&gt;
Acked-by: Thierry Reding &lt;treding@nvidia.com&gt;
Acked-by: Julia Lawall &lt;julia.lawall@inria.fr&gt;
Reviewed-by: Wolfram Sang &lt;wsa+renesas@sang-engineering.com&gt;
Reviewed-by: Mark Brown &lt;broonie@kernel.org&gt;
Signed-off-by: Maxime Ripard &lt;maxime@cerno.tech&gt;
Signed-off-by: Julia Lawall &lt;julia.lawall@inria.fr&gt;
</content>
</entry>
<entry>
<title>Merge branch 'for-5.10' of git://git.kernel.org/pub/scm/linux/kernel/git/jlawall/linux</title>
<updated>2020-10-18T21:20:35Z</updated>
<author>
<name>Linus Torvalds</name>
<email>torvalds@linux-foundation.org</email>
</author>
<published>2020-10-18T21:20:35Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=f66179ca7a7beebd504bea5c4422c402162a6048'/>
<id>urn:sha1:f66179ca7a7beebd504bea5c4422c402162a6048</id>
<content type='text'>
Pull coccinelle updates from Julia Lawall.

* 'for-5.10' of git://git.kernel.org/pub/scm/linux/kernel/git/jlawall/linux:
  coccinelle: api: add kfree_mismatch script
  coccinelle: iterators: Add for_each_child.cocci script
  scripts: coccicheck: Change default condition for parallelism
  scripts: coccicheck: Add quotes to improve portability
  coccinelle: api: kfree_sensitive: print memset position
  coccinelle: misc: add flexible_array.cocci script
  coccinelle: api: add kvmalloc script
  scripts: coccicheck: Change default value for parallelism
  coccinelle: misc: add excluded_middle.cocci script
  scripts: coccicheck: Improve error feedback when coccicheck fails
  coccinelle: api: update kzfree script to kfree_sensitive
  coccinelle: misc: add uninitialized_var.cocci script
  coccinelle: ifnullfree: add vfree(), kvfree*() functions
  coccinelle: api: add kobj_to_dev.cocci script
  coccinelle: add patch rule for dma_alloc_coherent
  scripts: coccicheck: Add chain mode to list of modes
</content>
</entry>
<entry>
<title>coccinelle: api: add kfree_mismatch script</title>
<updated>2020-10-17T21:11:06Z</updated>
<author>
<name>Denis Efremov</name>
<email>efremov@linux.com</email>
</author>
<published>2020-10-16T08:54:42Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=edc05fe5559e9b79e64cfec3b960f6a913b73493'/>
<id>urn:sha1:edc05fe5559e9b79e64cfec3b960f6a913b73493</id>
<content type='text'>
Check that alloc and free types of functions match each other.

Signed-off-by: Denis Efremov &lt;efremov@linux.com&gt;
Signed-off-by: Julia Lawall &lt;Julia.Lawall@lip6.fr&gt;
</content>
</entry>
</feed>
