linux-stable/tools
Christophe Leroy af289249ec selftests/vm: fix map_hugetlb length used for testing read and write
[ Upstream commit cabc30da10 ]

Commit fa7b9a805c ("tools/selftest/vm: allow choosing mem size and page
size in map_hugetlb") added the possibility to change the size of memory
mapped for the test, but left the read and write test using the default
value.  This is unnoticed when mapping a length greater than the default
one, but segfaults otherwise.

Fix read_bytes() and write_bytes() by giving them the real length.

Also fix the call to munmap().

Fixes: fa7b9a805c ("tools/selftest/vm: allow choosing mem size and page size in map_hugetlb")
Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Reviewed-by: Leonardo Bras <leonardo@linux.ibm.com>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Shuah Khan <shuah@kernel.org>
Cc: <stable@vger.kernel.org>
Link: http://lkml.kernel.org/r/9a404a13c871c4bd0ba9ede68f69a1225180dd7e.1580978385.git.christophe.leroy@c-s.fr
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-03-15 10:48:18 -04:00
..
accounting tools/accounting/getdelays.c: fix netlink attribute length 2020-04-13 10:45:10 +02:00
arch parisc: Align parisc MADV_XXX constants with all other architectures 2023-01-18 11:30:51 +01:00
bpf bpftool: Fix bug for long instructions in program CFG dumps 2023-05-17 11:13:13 +02:00
build tools build: Switch to new openssl API for test-libcrypto 2022-08-25 11:15:39 +02:00
cgroup
firewire
gpio tools: gpio-hammer: Avoid potential overflow in main 2020-10-01 13:14:39 +02:00
hv Tools: hv: kvp: eliminate 'may be used uninitialized' warning 2019-09-10 10:33:50 +01:00
iio tools: iio: iio_generic_buffer ensure alignment 2023-11-20 10:29:20 +01:00
include tools headers UAPI: Sync linux/perf_event.h with the kernel sources 2023-12-13 17:42:20 +01:00
kvm/kvm_stat tools/kvm_stat: Fix kvm_exit filter name 2020-02-11 04:34:08 -08:00
laptop
leds
lib libsubcmd: Fix memory leak in uniq() 2024-02-23 08:12:51 +01:00
memory-model
nfsd
objtool objtool: Add a missing comma to avoid string concatenation 2023-02-06 07:49:45 +01:00
pci tools: PCI: Fix broken pcitest compilation 2019-11-24 08:21:08 +01:00
pcmcia
perf perf genelf: Set ELF program header addresses properly 2024-01-25 14:33:38 -08:00
power cpupower: add Makefile dependencies for install targets 2023-10-10 21:45:01 +02:00
scripts tools: Factor HOSTCC, HOSTLD, HOSTAR definitions 2021-01-30 13:32:13 +01:00
spi
testing selftests/vm: fix map_hugetlb length used for testing read and write 2024-03-15 10:48:18 -04:00
thermal/tmon tools/thermal: Fix possible path truncations 2022-08-25 11:15:26 +02:00
time
usb usb: testusb: Fix for showing the connection speed 2021-10-09 14:11:03 +02:00
virtio tools/virtio: fix the vringh test for virtio ring changes 2023-02-22 12:47:19 +01:00
vm tools/vm/slabinfo-gnuplot: use "grep -E" instead of "egrep" 2022-12-08 11:18:33 +01:00
wmi
Makefile