<feed xmlns='http://www.w3.org/2005/Atom'>
<title>user/sven/linux.git/scripts/kconfig/expr.c, branch v4.4.245</title>
<subtitle>Linux Kernel
</subtitle>
<id>https://git.stealer.net/cgit.cgi/user/sven/linux.git/atom?h=v4.4.245</id>
<link rel='self' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/atom?h=v4.4.245'/>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/'/>
<updated>2020-01-12T10:22:50Z</updated>
<entry>
<title>kconfig: don't crash on NULL expressions in expr_eq()</title>
<updated>2020-01-12T10:22:50Z</updated>
<author>
<name>Thomas Hebb</name>
<email>tommyhebb@gmail.com</email>
</author>
<published>2019-12-09T08:19:17Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=26cee8d70ed7783585e3ecd36f748ee1ebd37d03'/>
<id>urn:sha1:26cee8d70ed7783585e3ecd36f748ee1ebd37d03</id>
<content type='text'>
[ Upstream commit 272a72103012862e3a24ea06635253ead0b6e808 ]

NULL expressions are taken to always be true, as implemented by the
expr_is_yes() macro and by several other functions in expr.c. As such,
they ought to be valid inputs to expr_eq(), which compares two
expressions.

Signed-off-by: Thomas Hebb &lt;tommyhebb@gmail.com&gt;
Signed-off-by: Masahiro Yamada &lt;masahiroy@kernel.org&gt;
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
</entry>
<entry>
<title>kconfig: Fix expr_free() E_NOT leak</title>
<updated>2018-05-30T05:48:53Z</updated>
<author>
<name>Ulf Magnusson</name>
<email>ulfalizer@gmail.com</email>
</author>
<published>2017-10-08T17:35:45Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=5bfe39f17ddbbb6bc22091d5588d9706608b49a4'/>
<id>urn:sha1:5bfe39f17ddbbb6bc22091d5588d9706608b49a4</id>
<content type='text'>
[ Upstream commit 5b1374b3b3c2fc4f63a398adfa446fb8eff791a4 ]

Only the E_NOT operand and not the E_NOT node itself was freed, due to
accidentally returning too early in expr_free(). Outline of leak:

	switch (e-&gt;type) {
	...
	case E_NOT:
		expr_free(e-&gt;left.expr);
		return;
	...
	}
	*Never reached, 'e' leaked*
	free(e);

Fix by changing the 'return' to a 'break'.

Summary from Valgrind on 'menuconfig' (ARCH=x86) before the fix:

	LEAK SUMMARY:
	   definitely lost: 44,448 bytes in 1,852 blocks
	   ...

Summary after the fix:

	LEAK SUMMARY:
	   definitely lost: 1,608 bytes in 67 blocks
	   ...

Signed-off-by: Ulf Magnusson &lt;ulfalizer@gmail.com&gt;
Signed-off-by: Masahiro Yamada &lt;yamada.masahiro@socionext.com&gt;
Signed-off-by: Sasha Levin &lt;alexander.levin@microsoft.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>kconfig: Fix copy&amp;paste error</title>
<updated>2015-10-20T17:13:14Z</updated>
<author>
<name>Michal Sojka</name>
<email>sojkam1@fel.cvut.cz</email>
</author>
<published>2015-10-19T14:51:02Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=f6aad2615c8c4ed806e70693adacb6c93f13564a'/>
<id>urn:sha1:f6aad2615c8c4ed806e70693adacb6c93f13564a</id>
<content type='text'>
Fixes: 31847b67bec0 ("kconfig: allow use of relations other than (in)equality")
Signed-off-by: Michal Sojka &lt;sojkam1@fel.cvut.cz&gt;
Reviewed-by: Jan Beulich &lt;jbeulich@suse.com&gt;
Signed-off-by: Michal Marek &lt;mmarek@suse.cz&gt;
</content>
</entry>
<entry>
<title>kconfig: allow use of relations other than (in)equality</title>
<updated>2015-06-15T12:05:58Z</updated>
<author>
<name>Jan Beulich</name>
<email>JBeulich@suse.com</email>
</author>
<published>2015-06-15T12:00:21Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=31847b67bec0e989961118520406a63fdeac7246'/>
<id>urn:sha1:31847b67bec0e989961118520406a63fdeac7246</id>
<content type='text'>
Over the years I found it desirable to be able to use all sorts of
relations, not just (in)equality. And apparently I'm not the only one,
as there's at least one example in the tree where the programmer
assumed this would work (see DEBUG_UART_8250_WORD in
arch/arm/Kconfig.debug). Another possible use would e.g. be to fold the
two SMP/NR_CPUS prompts into one: SMP could be promptless, simply
depending on NR_CPUS &gt; 1.

A (desirable) side effect of this change - resulting from numeric
values now necessarily being compared as numbers rather than as
strings - is that comparing hex values now works as expected: Other
than int ones (which aren't allowed to have leading zeroes), zeroes
following the 0x prefix made them compare unequal even if their values
were equal.

Signed-off-by: Jan Beulich &lt;jbeulich@suse.com&gt;
Signed-off-by: Michal Marek &lt;mmarek@suse.cz&gt;
</content>
</entry>
<entry>
<title>Kconfig: Remove bad inference rules expr_eliminate_dups2()</title>
<updated>2015-05-25T08:04:12Z</updated>
<author>
<name>Martin Walch</name>
<email>walch.martin@web.de</email>
</author>
<published>2015-05-22T11:41:52Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=e911503085ae8a6bb826588076f66df05890253c'/>
<id>urn:sha1:e911503085ae8a6bb826588076f66df05890253c</id>
<content type='text'>
expr_eliminate_dups2() in scripts/kconfig/expr.c applies two invalid
inference rules:

(FOO || BAR) &amp;&amp; (!FOO &amp;&amp; !BAR) -&gt; n
(FOO &amp;&amp; BAR) || (!FOO || !BAR) -&gt; y

They would be correct in propositional logic, but this is a three-valued
logic, and here it is wrong in that it changes semantics. It becomes
immediately visible when assigning the value 1 to both, FOO and BAR:

(FOO || BAR) &amp;&amp; (!FOO &amp;&amp; !BAR)
-&gt; min(max(1, 1), min(2-1, 2-1)) = min(1, 1) = 1

while n evaluates to 0 and

(FOO &amp;&amp; BAR) || (!FOO || !BAR)
-&gt; max(min(1, 1), max(2-1, 2-1)) = max(1, 1) = 1

with y evaluating to 2.

Fix it by removing expr_eliminate_dups2() and the functions that have no
use anywhere else: expr_extract_eq_and(), expr_extract_eq_or(),
and expr_extract_eq() from scripts/kconfig/expr.c

Currently the bug is not triggered in mainline, so this patch does not
modify the configuration space there. To observe the bug consider this
example:

config MODULES
        def_bool y
        option modules

config FOO
        def_tristate m

config BAR
        def_tristate m

config TEST1
        def_tristate y
        depends on (FOO || BAR) &amp;&amp; (!FOO &amp;&amp; !BAR)

if TEST1 = n
comment "TEST1 broken"
endif

config TEST2
        def_tristate y
        depends on (FOO &amp;&amp; BAR) || (!FOO || !BAR)

if TEST2 = y
comment "TEST2 broken"
endif

config TEST3
        def_tristate y
        depends on m &amp;&amp; !m

if TEST3 = n
comment "TEST3 broken"
endif

TEST1, TEST2 and TEST3 should all evaluate to m, but without the patch,
none of them does. It is probably not obvious that TEST3 is the same bug,
but it becomes clear when considering what happens internally to the
expression
m &amp;&amp; !m":
First it expands to
(m &amp;&amp; MODULES) &amp;&amp; !(m &amp;&amp; MODULES),
then it is transformed into
(m &amp;&amp; MODULES) &amp;&amp; (!m || !MODULES),
and finally due to the bug it is replaced with n.

As a side effect, this patch reduces code size in expr.c by roughly 10%
and slightly improves startup time for all configuration frontends.

Signed-off-by: Martin Walch &lt;walch.martin@web.de&gt;
Signed-off-by: Michal Marek &lt;mmarek@suse.cz&gt;
</content>
</entry>
<entry>
<title>kconfig: Remove unnecessary prototypes from headers</title>
<updated>2015-02-25T14:00:17Z</updated>
<author>
<name>Michal Marek</name>
<email>mmarek@suse.cz</email>
</author>
<published>2015-02-24T15:37:13Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=ad8d40cda3ad22ad9e8863d55a5c88f85c0173f0'/>
<id>urn:sha1:ad8d40cda3ad22ad9e8863d55a5c88f85c0173f0</id>
<content type='text'>
Signed-off-by: Michal Marek &lt;mmarek@suse.cz&gt;
</content>
</entry>
<entry>
<title>kconfig: Remove dead code</title>
<updated>2015-02-25T14:00:16Z</updated>
<author>
<name>Michal Marek</name>
<email>mmarek@suse.cz</email>
</author>
<published>2015-02-24T15:32:09Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=463157444e377bf9b279101b1f16a94c4648c03a'/>
<id>urn:sha1:463157444e377bf9b279101b1f16a94c4648c03a</id>
<content type='text'>
Signed-off-by: Michal Marek &lt;mmarek@suse.cz&gt;
</content>
</entry>
<entry>
<title>kconfig: Fix malloc handling in conf tools</title>
<updated>2012-11-20T11:12:47Z</updated>
<author>
<name>Alan Cox</name>
<email>alan@linux.intel.com</email>
</author>
<published>2012-11-06T14:32:08Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=177acf78468bf5c359bcb8823ee3bd48b04b8380'/>
<id>urn:sha1:177acf78468bf5c359bcb8823ee3bd48b04b8380</id>
<content type='text'>
(and get them out of the noise in the audit work)

Signed-off-by: Alan Cox &lt;alan@linux.intel.com&gt;
Signed-off-by: Michal Marek &lt;mmarek@suse.cz&gt;
</content>
</entry>
<entry>
<title>kconfig: use calloc() for expr allocation</title>
<updated>2011-07-02T05:04:37Z</updated>
<author>
<name>Arnaud Lacombe</name>
<email>lacombar@gmail.com</email>
</author>
<published>2010-09-20T02:45:00Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=8494453ad50599b0c9d099a230e423a89222ad08'/>
<id>urn:sha1:8494453ad50599b0c9d099a230e423a89222ad08</id>
<content type='text'>
Signed-off-by: Arnaud Lacombe &lt;lacombar@gmail.com&gt;
</content>
</entry>
<entry>
<title>kconfig: nuke LKC_DIRECT_LINK cruft</title>
<updated>2011-06-06T19:32:20Z</updated>
<author>
<name>Arnaud Lacombe</name>
<email>lacombar@gmail.com</email>
</author>
<published>2011-06-01T20:14:47Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=5a6f8d2bd9e3392569ed6f29ea4d7210652f929b'/>
<id>urn:sha1:5a6f8d2bd9e3392569ed6f29ea4d7210652f929b</id>
<content type='text'>
This interface is not (and has never been ?) used by any frontend, just get rid
of it.

Signed-off-by: Arnaud Lacombe &lt;lacombar@gmail.com&gt;
</content>
</entry>
</feed>
