]> git.ipfire.org Git - thirdparty/linux.git/commit
selftests/mm: ksm-functional-tests: fix partial write handling
authorVineet Agarwal <agarwal.vineet2006@gmail.com>
Mon, 4 May 2026 08:13:13 +0000 (13:43 +0530)
committerAndrew Morton <akpm@linux-foundation.org>
Tue, 2 Jun 2026 22:22:15 +0000 (15:22 -0700)
commit13f263b60fee0c463f3a9a6c728cd010d8802d69
treeed0f946864d727f4b87a805f0a0b9b212e21893b
parent8e0c2085c978ed6d9764d79fc785920360096f21
selftests/mm: ksm-functional-tests: fix partial write handling

Update write() checks to properly detect and handle partial writes.

Previously, the write() calls used <= 0 to detect failure.  This condition
is never true for partial writes (ret > 0 but ret < len), so partial
writes were silently treated as success.

Fix this by verifying that write() returns the full expected length and
treating any mismatch as failure.

Link: https://lore.kernel.org/20260504081638.683223-1-agarwal.vineet2006@gmail.com
Signed-off-by: Vineet Agarwal <agarwal.vineet2006@gmail.com>
Acked-by: Mike Rapoport (Microsoft) <rppt@kernel.org>
Acked-by: David Hildenbrand (Arm) <david@kernel.org>
Cc: Liam Howlett <liam@infradead.org>
Cc: Lorenzo Stoakes <ljs@kernel.org>
Cc: Michal Hocko <mhocko@suse.com>
Cc: Shuah Khan <shuah@kernel.org>
Cc: Suren Baghdasaryan <surenb@google.com>
Cc: Vlastimil Babka <vbabka@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
tools/testing/selftests/mm/ksm_functional_tests.c