diff options
| author | Hongfu Li <lihongfu@kylinos.cn> | 2026-05-13 10:52:23 +0800 |
|---|---|---|
| committer | Andrew Morton <akpm@linux-foundation.org> | 2026-06-21 11:37:31 -0700 |
| commit | a179686b917ca30232cb70eb4408d34d9de3814d (patch) | |
| tree | fdc30cfa67a193a99c6cf8ab09a01aee3c9c898e /drivers/gpu/nova-core/fsp/git@git.tavy.me:linux.git | |
| parent | b89a641056227403bf54847caf228b8a607c5fc4 (diff) | |
selftests/mm: fix incorrect mmap() error handling with NULL instead of MAP_FAILED
mmap() returns MAP_FAILED, which is defined as (void *)-1, on error, not
NULL. Several selftests incorrectly check the return value of mmap()
using !ptr or ptr == NULL, which would erroneously treat MAP_FAILED as a
valid pointer since MAP_FAILED is non-zero and non-NULL. This can lead to
segfaults when mmap() actually fails under memory pressure.
Link: https://lore.kernel.org/20260513025223.592766-1-lihongfu@kylinos.cn
Signed-off-by: Hongfu Li <lihongfu@kylinos.cn>
Reviewed-by: Dev Jain <dev.jain@arm.com>
Reviewed-by: Lorenzo Stoakes <ljs@kernel.org>
Cc: David Hildenbrand <david@kernel.org>
Cc: Liam R. Howlett <liam@infradead.org>
Cc: Michal Hocko <mhocko@suse.com>
Cc: Mike Rapoport <rppt@kernel.org>
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>
Diffstat (limited to 'drivers/gpu/nova-core/fsp/git@git.tavy.me:linux.git')
0 files changed, 0 insertions, 0 deletions
