<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel/scripts/coccinelle/free, branch linux-5.1.y</title>
<subtitle>Hosts the 0x221E linux distro kernel.</subtitle>
<id>https://universe.0xinfinity.dev/distro/kernel/atom?h=linux-5.1.y</id>
<link rel='self' href='https://universe.0xinfinity.dev/distro/kernel/atom?h=linux-5.1.y'/>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/'/>
<updated>2019-03-28T14:45:59Z</updated>
<entry>
<title>coccinelle: put_device: reduce false positives</title>
<updated>2019-03-28T14:45:59Z</updated>
<author>
<name>Wen Yang</name>
<email>wen.yang99@zte.com.cn</email>
</author>
<published>2019-03-23T06:14:31Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=7265f5b72640f43e558af80347c62e32d568371f'/>
<id>urn:sha1:7265f5b72640f43e558af80347c62e32d568371f</id>
<content type='text'>
Don't complain about a return when this function returns "&amp;pdev-&gt;dev".

Fixes: da9cfb87a44d ("coccinelle: semantic code search for missing put_device()")
Reported-by: Julia Lawall &lt;Julia.Lawall@lip6.fr&gt;
Signed-off-by: Wen Yang &lt;wen.yang99@zte.com.cn&gt;
Acked-by: Julia Lawall &lt;julia.lawall@lip6.fr&gt;
Signed-off-by: Masahiro Yamada &lt;yamada.masahiro@socionext.com&gt;
</content>
</entry>
<entry>
<title>coccinelle: semantic code search for missing put_device()</title>
<updated>2019-03-17T03:55:45Z</updated>
<author>
<name>Wen Yang</name>
<email>wen.yang99@zte.com.cn</email>
</author>
<published>2019-02-15T07:55:19Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=da9cfb87a44da61f2403c4312916befcb6b6d7e8'/>
<id>urn:sha1:da9cfb87a44da61f2403c4312916befcb6b6d7e8</id>
<content type='text'>
The of_find_device_by_node() takes a reference to the underlying device
structure, we should release that reference.
The implementation of this semantic code search is:
In a function, for a local variable returned by calling
of_find_device_by_node(),
a, if it is released by a function such as
   put_device()/of_dev_put()/platform_device_put() after the last use,
   it is considered that there is no reference leak;
b, if it is passed back to the caller via
   dev_get_drvdata()/platform_get_drvdata()/get_device(), etc., the
   reference will be released in other functions, and the current function
   also considers that there is no reference leak;
c, for the rest of the situation, the current function should release the
   reference by calling put_device, this code search will report the
   corresponding error message.

By using this semantic code search, we have found some object reference leaks,
such as:
commit 11907e9d3533 ("ASoC: fsl-asoc-card: fix object reference leaks in
fsl_asoc_card_probe")
commit a12085d13997 ("mtd: rawnand: atmel: fix possible object reference leak")
commit 11493f26856a ("mtd: rawnand: jz4780: fix possible object reference leak")

There are still dozens of reference leaks in the current kernel code.

Further, for the case of b, the object returned to other functions may also
have a reference leak, we will continue to develop other cocci scripts to
further check the reference leak.

Signed-off-by: Wen Yang &lt;wen.yang99@zte.com.cn&gt;
Reviewed-by: Julia Lawall &lt;Julia.Lawall@lip6.fr&gt;
Reviewed-by: Markus Elfring &lt;Markus.Elfring@web.de&gt;
Signed-off-by: Masahiro Yamada &lt;yamada.masahiro@socionext.com&gt;
</content>
</entry>
<entry>
<title>coccinelle: devm_free: reduce false positives</title>
<updated>2018-02-07T14:53:09Z</updated>
<author>
<name>Julia Lawall</name>
<email>Julia.Lawall@lip6.fr</email>
</author>
<published>2018-02-01T09:48:52Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=e856f3a7d706b37d8be9b41e41b19f4919570e57'/>
<id>urn:sha1:e856f3a7d706b37d8be9b41e41b19f4919570e57</id>
<content type='text'>
Some files use both a non-devm allocation and a devm_allocation.  Don't
complain about a free when the same function contains a non-devm
allocation.

Signed-off-by: Julia Lawall &lt;Julia.Lawall@lip6.fr&gt;
Signed-off-by: Masahiro Yamada &lt;yamada.masahiro@socionext.com&gt;
</content>
</entry>
<entry>
<title>Coccinelle: ifnullfree: Trim the warning reported in report mode</title>
<updated>2018-01-16T14:39:55Z</updated>
<author>
<name>Himanshu Jha</name>
<email>himanshujha199640@gmail.com</email>
</author>
<published>2018-01-13T15:58:15Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=3e47599fd61d6ba650b09e023f97bc9b9e7e390f'/>
<id>urn:sha1:3e47599fd61d6ba650b09e023f97bc9b9e7e390f</id>
<content type='text'>
Remove the unncessary part of the warning reported, in the report
mode, so that a single warning produced does not exceed more than line
and hence improve readability of the warnings produced in the subsequent
reports to a file.

Signed-off-by: Himanshu Jha &lt;himanshujha199640@gmail.com&gt;
Acked-by: Julia Lawall &lt;julia.lawall@lip6.fr&gt;
Signed-off-by: Masahiro Yamada &lt;yamada.masahiro@socionext.com&gt;
</content>
</entry>
<entry>
<title>coccinelle: catch krealloc() on devm_*() allocated memory</title>
<updated>2016-06-21T09:43:32Z</updated>
<author>
<name>Yann Droneaud</name>
<email>ydroneaud@opteya.com</email>
</author>
<published>2016-05-23T15:07:21Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=b7b2ee41f300b69c67c798df0cd5b8648bcb26a3'/>
<id>urn:sha1:b7b2ee41f300b69c67c798df0cd5b8648bcb26a3</id>
<content type='text'>
krealloc() must not be used against devm_*() allocated
memory regions:

- if a bigger memory is to be allocated, krealloc() and
  __krealloc() could return a different pointer than the
  one given to them, creating a memory region which is not
  managed, thus it will not be automatically released on
  device removal.

- if a bigger memory is to be allocated, krealloc() could
  kfree() the managed memory region which is passed to it.
  The old pointer is left registered as a resource for the
  device. On device removal, this dangling pointer will be
  used and an unrelated memory region could be released.

- if the requested size is equal to 0, krealloc() can also
  just behave like kfree(). Here too, the old pointer is
  kept associated with the device. On device removal, this
  invalid pointer will be used and an unrelated memory
  region could be released.

For all these reasons, krealloc() must not be used on a
pointer returned by devm_*() functions.

Cc: Tejun Heo &lt;tj@kernel.org&gt;
Cc: Pekka Enberg &lt;penberg@cs.helsinki.fi&gt;
Acked-by: Julia Lawall &lt;julia.lawall@lip6.fr&gt;
Signed-off-by: Yann Droneaud &lt;ydroneaud@opteya.com&gt;
Signed-off-by: Michal Marek &lt;mmarek@suse.com&gt;
</content>
</entry>
<entry>
<title>coccinelle: recognize more devm_* memory allocation functions</title>
<updated>2016-06-21T09:43:32Z</updated>
<author>
<name>Yann Droneaud</name>
<email>ydroneaud@opteya.com</email>
</author>
<published>2016-05-23T15:07:20Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=a720c0644d14011d3a1bcc8d1b36e80571ad2ce1'/>
<id>urn:sha1:a720c0644d14011d3a1bcc8d1b36e80571ad2ce1</id>
<content type='text'>
Updates free/devm_free.cocci to recognize functions added by:

- commit 64c862a839a8 ('devres: add kernel standard devm_k.alloc functions')
- commit e31108cad3de ('devres: introduce API "devm_kstrdup"')
- commit 3046365bb470 ('devres: introduce API "devm_kmemdup')
- commit 43339bed7010 ('devres: Add devm_get_free_pages API')
- commit 75f2a4ead5d5 ('devres: Add devm_kasprintf and devm_kvasprintf API')

See also Documentation/driver-model/devres.txt

Cc: Joe Perches &lt;joe@perches.com&gt;
Cc: Manish Badarkhe &lt;badarkhe.manish@gmail.com&gt;
Cc: Srinivas Pandruvada &lt;srinivas.pandruvada@linux.intel.com&gt;
Cc: Eli Billauer &lt;eli.billauer@gmail.com&gt;
Cc: Himangi Saraogi &lt;himangi774@gmail.com&gt;
Cc: Geert Uytterhoeven &lt;geert+renesas@glider.be&gt;
Cc: Wolfram Sang &lt;w.sang@pengutronix.de&gt;
Cc: Daniel Thompson &lt;daniel.thompson@linaro.org&gt;
Acked-by: Julia Lawall &lt;julia.lawall@lip6.fr&gt;
Signed-off-by: Yann Droneaud &lt;ydroneaud@opteya.com&gt;
Signed-off-by: Michal Marek &lt;mmarek@suse.com&gt;
</content>
</entry>
<entry>
<title>coccinelle: also catch kzfree() issues</title>
<updated>2016-06-21T09:43:32Z</updated>
<author>
<name>Yann Droneaud</name>
<email>ydroneaud@opteya.com</email>
</author>
<published>2016-05-23T15:07:19Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=6dd9379e8f327e70d182b15be3ba21aa2b5d2cba'/>
<id>urn:sha1:6dd9379e8f327e70d182b15be3ba21aa2b5d2cba</id>
<content type='text'>
Since commit 3ef0e5ba4673 ('slab: introduce kzfree()'),
kfree() is no more the only function to be considered:
kzfree() should be recognized too.

In particular, kzfree() must not be called on memory
allocated through devm_*() functions.

Cc: Johannes Weiner &lt;hannes@cmpxchg.org&gt;
Acked-by: Julia Lawall &lt;julia.lawall@lip6.fr&gt;
Signed-off-by: Yann Droneaud &lt;ydroneaud@opteya.com&gt;
Signed-off-by: Michal Marek &lt;mmarek@suse.com&gt;
</content>
</entry>
<entry>
<title>coccinelle: ifnullfree: handle various destroy functions</title>
<updated>2015-10-26T21:41:18Z</updated>
<author>
<name>Julia Lawall</name>
<email>Julia.Lawall@lip6.fr</email>
</author>
<published>2015-10-26T21:28:26Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=4743775c6de44b3c36e15bcab2dee928b6361a16'/>
<id>urn:sha1:4743775c6de44b3c36e15bcab2dee928b6361a16</id>
<content type='text'>
Extend ifnullfree to the various destroy functions that were recently
extended to tolerate NULL arguments.

Signed-off-by: Julia Lawall &lt;Julia.Lawall@lip6.fr&gt;
Signed-off-by: Michal Marek &lt;mmarek@suse.cz&gt;
</content>
</entry>
<entry>
<title>coccinelle: ifnullfree: various cleanups</title>
<updated>2015-10-26T21:41:13Z</updated>
<author>
<name>Julia Lawall</name>
<email>Julia.Lawall@lip6.fr</email>
</author>
<published>2015-10-26T21:28:25Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=ca047e715c638eacf58cb830c3ef36cecc45c3f8'/>
<id>urn:sha1:ca047e715c638eacf58cb830c3ef36cecc45c3f8</id>
<content type='text'>
Adjust tests to compare against NULL, to match cases that explicitly make
that comparison.

Remove removal and re-addition of freeing functions.

Add position variable on usb_free_urb in the non-patch case.

Signed-off-by: Julia Lawall &lt;Julia.Lawall@lip6.fr&gt;
Signed-off-by: Michal Marek &lt;mmarek@suse.cz&gt;
</content>
</entry>
<entry>
<title>scripts/coccinelle/free/ifnullfree.cocci: add copyright information</title>
<updated>2014-08-08T22:57:27Z</updated>
<author>
<name>Fabian Frederick</name>
<email>fabf@skynet.be</email>
</author>
<published>2014-08-08T21:23:31Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=45715f33d447ba878a3ca81673514785bb4dfe5a'/>
<id>urn:sha1:45715f33d447ba878a3ca81673514785bb4dfe5a</id>
<content type='text'>
All coccinelle scripts have a copyright in the header.

Signed-off-by: Fabian Frederick &lt;fabf@skynet.be&gt;
Suggested-by: Julia Lawall &lt;Julia.Lawall@lip6.fr&gt;
Acked-by: Julia Lawall &lt;Julia.Lawall@lip6.fr&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
</entry>
</feed>
