All of lore.kernel.org
 help / color / mirror / Atom feed
From: "David Hildenbrand (Arm)" <david@kernel.org>
To: Sayali Patil <sayalip@linux.ibm.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	Shuah Khan <shuah@kernel.org>,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org,
	linux-kselftest@vger.kernel.org,
	Ritesh Harjani <ritesh.list@gmail.com>
Cc: Zi Yan <ziy@nvidia.com>, Michal Hocko <mhocko@kernel.org>,
	Oscar Salvador <osalvador@suse.de>,
	Lorenzo Stoakes <lorenzo.stoakes@oracle.com>,
	Dev Jain <dev.jain@arm.com>,
	Liam.Howlett@oracle.com, linuxppc-dev@lists.ozlabs.org,
	Miaohe Lin <linmiaohe@huawei.com>,
	Venkat Rao Bagalkote <venkat88@linux.ibm.com>
Subject: Re: [PATCH v2 3/3] selftests/mm: fix ternary operator precedence in ksm_tests
Date: Tue, 30 Jun 2026 12:33:55 +0200	[thread overview]
Message-ID: <c07c7a6b-da47-4d05-b501-d338e944d861@kernel.org> (raw)
In-Reply-To: <bea784beacee411394c332272df9e68148caf7f3.1782811071.git.sayalip@linux.ibm.com>

On 6/30/26 11:32, Sayali Patil wrote:
> The KSM selftest uses conditional expressions to skip accesses to
> merge_across_nodes on systems without NUMA support. However, the
> ternary operator is combined with logical OR without parentheses:
> 
> a || numa_available() ? 0 : b || c
> 
> Due to operator precedence rules, this is parsed as:
> 
> (a || numa_available()) ? 0 : (b || c)
> 
> instead of the intended:
> 
> a || (numa_available() ? 0 : b) || c
> 
> Add parentheses around the conditional expressions to ensure the
> correct evaluation order.
> 
> Fixes: 9aa1af954db0 ("selftests: vm: check numa_available() before operating "merge_across_nodes" in ksm_tests")
> Signed-off-by: Sayali Patil <sayalip@linux.ibm.com>
> ---

LGTM, although the code is a bit ugly (already before your changes).

Acked-by: David Hildenbrand (Arm) <david@kernel.org>

-- 
Cheers,

David

      reply	other threads:[~2026-06-30 10:33 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-30  9:32 [PATCH v2 0/3] selftests/mm: avoid false failures in hugetlb and KSM tests Sayali Patil
2026-06-30  9:32 ` [PATCH v2 1/3] selftests/mm: handle EINVAL when configuring gigantic hugepages Sayali Patil
2026-06-30 10:45   ` David Hildenbrand (Arm)
2026-06-30 20:20     ` Sayali Patil
2026-07-01  8:48       ` David Hildenbrand (Arm)
2026-06-30  9:32 ` [PATCH v2 2/3] selftests/mm: fix ksm NUMA merge test for systems with memoryless NUMA nodes Sayali Patil
2026-06-30 10:45   ` Sayali Patil
2026-06-30  9:32 ` [PATCH v2 3/3] selftests/mm: fix ternary operator precedence in ksm_tests Sayali Patil
2026-06-30 10:33   ` David Hildenbrand (Arm) [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=c07c7a6b-da47-4d05-b501-d338e944d861@kernel.org \
    --to=david@kernel.org \
    --cc=Liam.Howlett@oracle.com \
    --cc=akpm@linux-foundation.org \
    --cc=dev.jain@arm.com \
    --cc=linmiaohe@huawei.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=lorenzo.stoakes@oracle.com \
    --cc=mhocko@kernel.org \
    --cc=osalvador@suse.de \
    --cc=ritesh.list@gmail.com \
    --cc=sayalip@linux.ibm.com \
    --cc=shuah@kernel.org \
    --cc=venkat88@linux.ibm.com \
    --cc=ziy@nvidia.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.