<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel/linux.git/scripts/coccicheck, branch v6.19.11</title>
<subtitle>Linux kernel stable tree (mirror)</subtitle>
<id>https://git.radix-linux.su/kernel/linux.git/atom?h=v6.19.11</id>
<link rel='self' href='https://git.radix-linux.su/kernel/linux.git/atom?h=v6.19.11'/>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/'/>
<updated>2025-12-21T20:04:45+00:00</updated>
<entry>
<title>scripts: coccicheck: filter *.cocci files by MODE</title>
<updated>2025-12-21T20:04:45+00:00</updated>
<author>
<name>Songwei Chai</name>
<email>quic_songchai@quicinc.com</email>
</author>
<published>2025-06-06T06:09:36+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=3766511de1ce62472898d0ffafeb2551c880b161'/>
<id>urn:sha1:3766511de1ce62472898d0ffafeb2551c880b161</id>
<content type='text'>
Enhance the coccicheck script to filter *.cocci files based on the
specified MODE (e.g., report, patch). This ensures that only compatible
semantic patch files are executed, preventing errors such as:

    "virtual rule report not supported"

This error occurs when a .cocci file does not define a 'virtual &lt;MODE&gt;'
rule, yet is executed in that mode.

For example:

    make coccicheck M=drivers/hwtracing/coresight/ MODE=report

In this case, running "secs_to_jiffies.cocci" would trigger the error
because it lacks support for 'report' mode. With this change, such files
are skipped automatically, improving robustness and developer
experience.

Signed-off-by: Songwei Chai &lt;quic_songchai@quicinc.com&gt;
Reviewed-by: Julia Lawall &lt;Julia.Lawall@inria.fr&gt;
</content>
</entry>
<entry>
<title>kbuild: change working directory to external module directory with M=</title>
<updated>2024-11-27T23:10:23+00:00</updated>
<author>
<name>Masahiro Yamada</name>
<email>masahiroy@kernel.org</email>
</author>
<published>2024-11-10T01:34:33+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=13b25489b6f8bd73ed65f07928f7c27a481f1820'/>
<id>urn:sha1:13b25489b6f8bd73ed65f07928f7c27a481f1820</id>
<content type='text'>
Currently, Kbuild always operates in the output directory of the kernel,
even when building external modules. This increases the risk of external
module Makefiles attempting to write to the kernel directory.

This commit switches the working directory to the external module
directory, allowing the removal of the $(KBUILD_EXTMOD)/ prefix from
some build artifacts.

The command for building external modules maintains backward
compatibility, but Makefiles that rely on working in the kernel
directory may break. In such cases, $(objtree) and $(srctree) should
be used to refer to the output and source directories of the kernel.

The appearance of the build log will change as follows:

[Before]

  $ make -C /path/to/my/linux M=/path/to/my/externel/module
  make: Entering directory '/path/to/my/linux'
    CC [M]  /path/to/my/externel/module/helloworld.o
    MODPOST /path/to/my/externel/module/Module.symvers
    CC [M]  /path/to/my/externel/module/helloworld.mod.o
    CC [M]  /path/to/my/externel/module/.module-common.o
    LD [M]  /path/to/my/externel/module/helloworld.ko
  make: Leaving directory '/path/to/my/linux'

[After]

  $ make -C /path/to/my/linux M=/path/to/my/externel/module
  make: Entering directory '/path/to/my/linux'
  make[1]: Entering directory '/path/to/my/externel/module'
    CC [M]  helloworld.o
    MODPOST Module.symvers
    CC [M]  helloworld.mod.o
    CC [M]  .module-common.o
    LD [M]  helloworld.ko
  make[1]: Leaving directory '/path/to/my/externel/module'
  make: Leaving directory '/path/to/my/linux'

Printing "Entering directory" twice is cumbersome. This will be
addressed later.

Signed-off-by: Masahiro Yamada &lt;masahiroy@kernel.org&gt;
Reviewed-by: Nicolas Schier &lt;n.schier@avm.de&gt;
</content>
</entry>
<entry>
<title>scripts: coccicheck: Use /usr/bin/env</title>
<updated>2023-02-25T19:11:06+00:00</updated>
<author>
<name>Jarkko Sakkinen</name>
<email>jarkko@kernel.org</email>
</author>
<published>2023-01-26T21:56:12+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=2b2d50bdd258f8ef37c25f7d5f0d7ba694066dec'/>
<id>urn:sha1:2b2d50bdd258f8ef37c25f7d5f0d7ba694066dec</id>
<content type='text'>
If bash is not located under /bin, coccicheck fails to run.  In the real
world, this happens for instance when NixOS is used in the host.  Instead,
use /usr/bin/env to locate the executable binary for bash.

Signed-off-by: Jarkko Sakkinen &lt;jarkko@kernel.org&gt;
Tested-by: Deepak R Varma &lt;drv@mailo.com&gt;
Signed-off-by: Julia Lawall &lt;Julia.Lawall@inria.fr&gt;
</content>
</entry>
<entry>
<title>scripts: coccicheck: Avoid warning about spurious escape</title>
<updated>2023-02-25T19:08:50+00:00</updated>
<author>
<name>Peter Foley</name>
<email>pefoley2@pefoley.com</email>
</author>
<published>2023-01-13T17:29:36+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=180da5ef84fba0a8ea06870a38d6d657d689944a'/>
<id>urn:sha1:180da5ef84fba0a8ea06870a38d6d657d689944a</id>
<content type='text'>
e.g.
grep: warning: stray \ before -

Signed-off-by: Peter Foley &lt;pefoley2@pefoley.com&gt;
Signed-off-by: Julia Lawall &lt;Julia.Lawall@inria.fr&gt;
</content>
</entry>
<entry>
<title>scripts: coccicheck: use "grep -E" instead of "egrep"</title>
<updated>2022-09-21T19:23:56+00:00</updated>
<author>
<name>Greg Kroah-Hartman</name>
<email>gregkh@linuxfoundation.org</email>
</author>
<published>2022-09-21T09:13:41+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=2d63e6a3d97132449451c2f66fe24a2dc4e2938f'/>
<id>urn:sha1:2d63e6a3d97132449451c2f66fe24a2dc4e2938f</id>
<content type='text'>
The latest version of grep claims that egrep is now obsolete so the build
now contains warnings that look like:
        egrep: warning: egrep is obsolescent; using grep -E
fix this up by moving the vdso Makefile to use "grep -E" instead.

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: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>scripts: coccicheck: fix troubles on non-English builds</title>
<updated>2021-05-18T09:09:59+00:00</updated>
<author>
<name>Mauro Carvalho Chehab</name>
<email>mchehab+huawei@kernel.org</email>
</author>
<published>2021-05-18T09:05:26+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=f5b3553b5019f22ac668651ea9cddb9fa675ac41'/>
<id>urn:sha1:f5b3553b5019f22ac668651ea9cddb9fa675ac41</id>
<content type='text'>
When LANG is not set to English, the logic which checks the
number of CPUs fail, as the messages can be localized, and
the logic at:

    THREADS_PER_CORE=$(lscpu | grep "Thread(s) per core: " | tr -cd "[:digit:]")

will not get the number of threads per core.

This causes the script to not run properly, as it will produce
a warning:

	$ make coccicheck COCCI=$PWD/scripts/coccinelle/misc/add_namespace.cocci MODE=report drivers/media/
	./scripts/coccicheck: linha 93: [: número excessivo de argumentos

Fix it by forcing LANG=C when calling lscpu.

Signed-off-by: Mauro Carvalho Chehab &lt;mchehab+huawei@kernel.org&gt;
Signed-off-by: Julia Lawall &lt;Julia.Lawall@inria.fr&gt;
</content>
</entry>
<entry>
<title>scripts: coccicheck: Correct usage of make coccicheck</title>
<updated>2020-12-24T11:59:43+00:00</updated>
<author>
<name>Sumera Priyadarsini</name>
<email>sylphrenadin@gmail.com</email>
</author>
<published>2020-11-24T20:32:12+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=d8f6e5c6c83737cfdad46077e614885a3db9e809'/>
<id>urn:sha1:d8f6e5c6c83737cfdad46077e614885a3db9e809</id>
<content type='text'>
The command "make coccicheck C=1 CHECK=scripts/coccicheck" results in the
error:
        ./scripts/coccicheck: line 65: -1: shift count out of range

This happens because every time the C variable is specified,
the shell arguments need to be "shifted" in order to take only
the last argument, which is the C file to test. These shell arguments
mostly comprise flags that have been set in the Makefile. However,
when coccicheck is specified in the make command as a rule, the
number of shell arguments is zero, thus passing the invalid value -1
to the shift command, resulting in an error.

Modify coccicheck to print correct usage of make coccicheck so as to
avoid the error.

Signed-off-by: Sumera Priyadarsini &lt;sylphrenadin@gmail.com&gt;
Signed-off-by: Julia Lawall &lt;Julia.Lawall@inria.fr&gt;
</content>
</entry>
<entry>
<title>kbuild: do not use scripts/ld-version.sh for checking spatch version</title>
<updated>2020-12-12T17:31:29+00:00</updated>
<author>
<name>Masahiro Yamada</name>
<email>masahiroy@kernel.org</email>
</author>
<published>2020-12-12T16:54:29+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=33114c4359592d5c8a3d840eee9ff40039caf26f'/>
<id>urn:sha1:33114c4359592d5c8a3d840eee9ff40039caf26f</id>
<content type='text'>
scripts/ld-version.sh was, as its file name implies, originally intended
for the GNU ld version, but is (ab)used for the spatch version too.

Use 'sort -CV' for the version comparison, then coccicheck does not need
to use scripts/ld-version.sh. Fix nsdeps as well.

Signed-off-by: Masahiro Yamada &lt;masahiroy@kernel.org&gt;
Signed-off-by: Julia Lawall &lt;Julia.Lawall@inria.fr&gt;
</content>
</entry>
<entry>
<title>scripts: coccicheck: Change default condition for parallelism</title>
<updated>2020-10-12T08:37:56+00:00</updated>
<author>
<name>Sumera Priyadarsini</name>
<email>sylphrenadin@gmail.com</email>
</author>
<published>2020-10-11T10:29:42+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=c5864560d935db879cafa21feca0156d91eba842'/>
<id>urn:sha1:c5864560d935db879cafa21feca0156d91eba842</id>
<content type='text'>
Currently, Coccinelle uses at most one thread per core by default in
machines with more than 2 hyperthreads. However, for systems with only 4
hyperthreads, this does not improve performance.

Modify coccicheck to use all available threads in machines with
upto 4 hyperthreads.

Signed-off-by: Sumera Priyadarsini &lt;sylphrenadin@gmail.com&gt;
Signed-off-by: Julia Lawall &lt;Julia.Lawall@inria.fr&gt;
</content>
</entry>
<entry>
<title>scripts: coccicheck: Add quotes to improve portability</title>
<updated>2020-10-12T08:32:40+00:00</updated>
<author>
<name>Sumera Priyadarsini</name>
<email>sylphrenadin@gmail.com</email>
</author>
<published>2020-10-11T10:28:43+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=2f324dd8ab2e3d8b097f3eac6d380d1adbdbe6e6'/>
<id>urn:sha1:2f324dd8ab2e3d8b097f3eac6d380d1adbdbe6e6</id>
<content type='text'>
While fetching the number of threads per core with lscpu,
the [:digit:] set is used for translation of digits from 0-9.
However, using [:digit:] instead of "[:digit:]" does not seem
to work uniformly for some shell types and configurations
(such as zsh).

Therefore, modify coccicheck to use double quotes around the
[:digit:] set for uniformity and better portability.

Signed-off-by: Sumera Priyadarsini &lt;sylphrenadin@gmail.com&gt;
Signed-off-by: Julia Lawall &lt;Julia.Lawall@inria.fr&gt;
</content>
</entry>
</feed>
