<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux/scripts/basic, branch v4.16-rc2</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/
</subtitle>
<id>https://www.git.shady.money/linux/atom?h=v4.16-rc2</id>
<link rel='self' href='https://www.git.shady.money/linux/atom?h=v4.16-rc2'/>
<link rel='alternate' type='text/html' href='https://www.git.shady.money/linux/'/>
<updated>2018-01-18T00:37:39Z</updated>
<entry>
<title>fixdep: use existing helper to check modular CONFIG options</title>
<updated>2018-01-18T00:37:39Z</updated>
<author>
<name>Masahiro Yamada</name>
<email>yamada.masahiro@socionext.com</email>
</author>
<published>2018-01-11T13:05:46Z</published>
<link rel='alternate' type='text/html' href='https://www.git.shady.money/linux/commit/?id=ab9ce9feed362f3f51e239f9421b220aaf9211aa'/>
<id>urn:sha1:ab9ce9feed362f3f51e239f9421b220aaf9211aa</id>
<content type='text'>
str_ends_with() tests if the given token ends with a particular string.
Currently, it is used to check file paths without $(srctree).

Actually, we have one more place where this helper is useful.  Use it
to check if CONFIG option ends with _MODULE.

Signed-off-by: Masahiro Yamada &lt;yamada.masahiro@socionext.com&gt;
</content>
</entry>
<entry>
<title>fixdep: refactor parse_dep_file()</title>
<updated>2018-01-18T00:37:39Z</updated>
<author>
<name>Masahiro Yamada</name>
<email>yamada.masahiro@socionext.com</email>
</author>
<published>2018-01-11T13:05:45Z</published>
<link rel='alternate' type='text/html' href='https://www.git.shady.money/linux/commit/?id=87b95a81357dd6ec679a786cebfe34d0e797f752'/>
<id>urn:sha1:87b95a81357dd6ec679a786cebfe34d0e797f752</id>
<content type='text'>
parse_dep_file() has too much indentation, and puts the code far to
the right.  This commit refactors the code and reduces the one level
of indentation.

strrcmp() computes 'slen' by itself, but the caller already knows the
length of the token, so 'slen' can be passed via function argument.
With this, we can swap the order of strrcmp() and "*p = \0;"

Also, strrcmp() is an ambiguous function name.  Flip the logic and
rename it to str_ends_with().

I added a new helper is_ignored_file() - this returns 1 if the token
represents a file that should be ignored.

Signed-off-by: Masahiro Yamada &lt;yamada.masahiro@socionext.com&gt;
</content>
</entry>
<entry>
<title>fixdep: move global variables to local variables of main()</title>
<updated>2018-01-18T00:37:38Z</updated>
<author>
<name>Masahiro Yamada</name>
<email>yamada.masahiro@socionext.com</email>
</author>
<published>2018-01-11T13:05:44Z</published>
<link rel='alternate' type='text/html' href='https://www.git.shady.money/linux/commit/?id=5d1ef76f5a22ea07120671c5fcddafd365000cc9'/>
<id>urn:sha1:5d1ef76f5a22ea07120671c5fcddafd365000cc9</id>
<content type='text'>
I do not mind global variables where they are useful enough.  In this
case, I do not see a good reason to use global variables since they
are just referenced in shallow places.  It is easy to pass them via
function arguments.

I squashed print_cmdline() into main() since it is just one line code.

Signed-off-by: Masahiro Yamada &lt;yamada.masahiro@socionext.com&gt;
</content>
</entry>
<entry>
<title>fixdep: remove unneeded memcpy() in parse_dep_file()</title>
<updated>2018-01-18T00:37:38Z</updated>
<author>
<name>Masahiro Yamada</name>
<email>yamada.masahiro@socionext.com</email>
</author>
<published>2018-01-11T13:05:43Z</published>
<link rel='alternate' type='text/html' href='https://www.git.shady.money/linux/commit/?id=ccfe78873c22561d3c514790094dc408e4876077'/>
<id>urn:sha1:ccfe78873c22561d3c514790094dc408e4876077</id>
<content type='text'>
Each token in the depfile is copied to the temporary buffer 's' to
terminate the token with zero.  We do not need to do this any more
because the parsed buffer is now writable.  Insert '\0' directly in
the buffer without calling memcpy().

&lt;limits.h&gt; is no longer necessary. (It was needed for PATH_MAX).

Signed-off-by: Masahiro Yamada &lt;yamada.masahiro@socionext.com&gt;
</content>
</entry>
<entry>
<title>fixdep: factor out common code for reading files</title>
<updated>2018-01-18T00:37:38Z</updated>
<author>
<name>Masahiro Yamada</name>
<email>yamada.masahiro@socionext.com</email>
</author>
<published>2018-01-11T13:05:42Z</published>
<link rel='alternate' type='text/html' href='https://www.git.shady.money/linux/commit/?id=4003fd80cba967e4044ebac96f13746153e87c4d'/>
<id>urn:sha1:4003fd80cba967e4044ebac96f13746153e87c4d</id>
<content type='text'>
Now, do_config_files() and print_deps() are almost the same.  Only
the difference is the parser function called (parse_config_file vs
parse_dep_file).

We can reduce the code duplication by factoring out the common code
into read_file() - this function allocates a buffer and loads a file
to it.  It returns the pointer to the allocated buffer.  (As before,
it bails out by exit(2) for any error.)  The caller must free the
buffer when done.

Having empty source files is possible; fixdep should simply skip them.
I deleted the "st.st_size == 0" check, so read_file() allocates 1-byte
buffer for an empty file.  strstr() will immediately return NULL, and
this is what we expect.

On the other hand, an empty dep_file should be treated as an error.
In this case, parse_dep_file() will error out with "no targets found"
and it is a correct error message.

Signed-off-by: Masahiro Yamada &lt;yamada.masahiro@socionext.com&gt;
</content>
</entry>
<entry>
<title>fixdep: use malloc() and read() to load dep_file to buffer</title>
<updated>2018-01-18T00:37:37Z</updated>
<author>
<name>Masahiro Yamada</name>
<email>yamada.masahiro@socionext.com</email>
</author>
<published>2018-01-11T13:05:41Z</published>
<link rel='alternate' type='text/html' href='https://www.git.shady.money/linux/commit/?id=01b5cbe7012fb1eeffc5c143865569835bcd405e'/>
<id>urn:sha1:01b5cbe7012fb1eeffc5c143865569835bcd405e</id>
<content type='text'>
Commit dee81e988674 ("fixdep: faster CONFIG_ search") changed how to
read files in which CONFIG options are searched.  It used malloc()
and read() instead of mmap() because it needed to zero-terminate the
buffer in order to use strstr().  print_deps() was left untouched
since there was no reason to change it.

Now, I have two motivations to change it in the same way.

 - do_config_file() and print_deps() do quite similar things; they
   open a file, load it onto memory, and pass it to a parser function.
   If we use malloc() and read() for print_deps() too, we can factor
   out the common code.  (I will do this in the next commit.)

 - parse_dep_file() copies each token to a temporary buffer because
   it needs to zero-terminate it to be passed to printf().  It is not
   possible to modify the buffer directly because it is mmap'ed with
   O_RDONLY.  If we load the file content into a malloc'ed buffer, we
   can insert '\0' after each token, and save memcpy().  (I will do
   this in the commit after next.)

Signed-off-by: Masahiro Yamada &lt;yamada.masahiro@socionext.com&gt;
</content>
</entry>
<entry>
<title>fixdep: remove unnecessary &lt;arpa/inet.h&gt; inclusion</title>
<updated>2018-01-18T00:37:37Z</updated>
<author>
<name>Masahiro Yamada</name>
<email>yamada.masahiro@socionext.com</email>
</author>
<published>2018-01-11T13:05:40Z</published>
<link rel='alternate' type='text/html' href='https://www.git.shady.money/linux/commit/?id=41f92cffba1908bc7acc847e498e34368be29dc7'/>
<id>urn:sha1:41f92cffba1908bc7acc847e498e34368be29dc7</id>
<content type='text'>
&lt;arpa/inet.h&gt; was included for ntohl(), but it was removed by
commit dee81e988674 ("fixdep: faster CONFIG_ search").

Signed-off-by: Masahiro Yamada &lt;yamada.masahiro@socionext.com&gt;
</content>
</entry>
<entry>
<title>fixdep: exit with error code in error branches of do_config_file()</title>
<updated>2018-01-08T14:51:26Z</updated>
<author>
<name>Lukas Bulwahn</name>
<email>lukas.bulwahn@gmail.com</email>
</author>
<published>2018-01-08T10:04:01Z</published>
<link rel='alternate' type='text/html' href='https://www.git.shady.money/linux/commit/?id=7c2ec43a2154c9cd6477f85de8d247ad491cf2d1'/>
<id>urn:sha1:7c2ec43a2154c9cd6477f85de8d247ad491cf2d1</id>
<content type='text'>
do_config_file() should exit with an error code on internal run-time
errors, and not return if it fails as then the error in do_config_file()
would go unnoticed in the current code and allow the build to continue.
The exit with error code will make the build fail in those very
exceptional cases. If this occurs, this actually indicates a deeper
problem in the execution of the kernel build process.

Now, in these error cases, we do not explicitly free memory and close
the file handlers in do_config_file(), as this is covered by exit().

This issue in the fixdep script was introduced with its initial
implementation back in 2002 by the original author Kai Germaschewski with
this commit 04bd72170653 ("kbuild: Make dependencies at compile time")
in the linux history git tree, i.e.,
git://git.kernel.org/pub/scm/linux/kernel/git/history/history.git.

This issue was identified during the review of a previous patch that
intended to address a memory leak detected by a static analysis tool.

Link: https://lkml.org/lkml/2017/12/14/736

Suggested-by: Nicholas Mc Guire &lt;der.herr@hofr.at&gt;
Suggested-by: Masahiro Yamada &lt;yamada.masahiro@socionext.com&gt;
Signed-off-by: Lukas Bulwahn &lt;lukas.bulwahn@gmail.com&gt;
Signed-off-by: Masahiro Yamada &lt;yamada.masahiro@socionext.com&gt;
</content>
</entry>
<entry>
<title>fixdep: trivial: typo fix and correction</title>
<updated>2017-08-09T16:01:03Z</updated>
<author>
<name>Cao jin</name>
<email>caoj.fnst@cn.fujitsu.com</email>
</author>
<published>2017-08-08T13:20:50Z</published>
<link rel='alternate' type='text/html' href='https://www.git.shady.money/linux/commit/?id=4e433fc4d1a93310d31e7671faca8660a2890908'/>
<id>urn:sha1:4e433fc4d1a93310d31e7671faca8660a2890908</id>
<content type='text'>
Signed-off-by: Cao jin &lt;caoj.fnst@cn.fujitsu.com&gt;
Signed-off-by: Masahiro Yamada &lt;yamada.masahiro@socionext.com&gt;
</content>
</entry>
<entry>
<title>kbuild: trivial cleanups on the comments</title>
<updated>2017-08-09T15:58:20Z</updated>
<author>
<name>Cao jin</name>
<email>caoj.fnst@cn.fujitsu.com</email>
</author>
<published>2017-08-02T02:31:06Z</published>
<link rel='alternate' type='text/html' href='https://www.git.shady.money/linux/commit/?id=312a3d0918bb7d65862fbbd3e2f2f4630e4d6f56'/>
<id>urn:sha1:312a3d0918bb7d65862fbbd3e2f2f4630e4d6f56</id>
<content type='text'>
This is a bunch of trivial fixes and cleanups.

Signed-off-by: Cao jin &lt;caoj.fnst@cn.fujitsu.com&gt;
Signed-off-by: Masahiro Yamada &lt;yamada.masahiro@socionext.com&gt;
</content>
</entry>
</feed>
