[PATCH 1/3] slab: check the return value of check_bytes_and_report()

From: Chengming Zhou
Date: Tue May 28 2024 - 03:18:14 EST


All check_bytes_and_report() callers have checked its return value except
for this one. We should also check its return value here obviously, so
fix it.

Signed-off-by: Chengming Zhou <chengming.zhou@xxxxxxxxx>
---
mm/slub.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/mm/slub.c b/mm/slub.c
index 0809760cf789..de57512734ac 100644
--- a/mm/slub.c
+++ b/mm/slub.c
@@ -1324,9 +1324,10 @@ static int check_object(struct kmem_cache *s, struct slab *slab,
}
} else {
if ((s->flags & SLAB_POISON) && s->object_size < s->inuse) {
- check_bytes_and_report(s, slab, p, "Alignment padding",
+ if (!check_bytes_and_report(s, slab, p, "Alignment padding",
endobject, POISON_INUSE,
- s->inuse - s->object_size);
+ s->inuse - s->object_size))
+ return 0;
}
}


--
2.45.1