mm/vmalloc: replace BUG_ON to WARN_ON
Subsystems (2)
PATCH v2 1/1 mm/vmalloc: replace BUG_ON to WARN_ON
As per the coding standards, in the event of an abnormal condition that should not occur under normal circumstances, the kernel should attempt recovery and proceed with execution, rather than halting the machine. Specifically, in the alloc_vmap_area() function, use WARN_ON() and fail the request instead of using BUG_ON() to halt the machine.
Co-Developed-by Gwan-gyeong Mun <[email protected]>
Co-Developed-by Jeungwoo Yoo <[email protected]>
Co-Developed-by Sangyun Kim <[email protected]>
Signed-off-by Hyunmin Lee <[email protected]>
Signed-off-by Gwan-gyeong Mun <[email protected]>
Signed-off-by Jeungwoo Yoo <[email protected]>
Signed-off-by Sangyun Kim <[email protected]>
Cc Hyeonggon Yoo <[email protected]>
--- mm/vmalloc.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-)
mm/vmalloc.c +8 -3
@@ -1587,9 +1587,14 @@ static struct vmap_area *alloc_vmap_area(unsigned long size,int purged =0 ;int ret; -BUG_ON (!size); -BUG_ON (offset_in_page (size)); -BUG_ON (!is_power_of_2 (align)); +if (WARN_ON (!size)) +return ERR_PTR (-EINVAL ); + +if (WARN_ON (offset_in_page (size))) +return ERR_PTR (-EINVAL ); + +if (WARN_ON (!is_power_of_2 (align))) +return ERR_PTR (-EINVAL );if (unlikely (!vmap_initialized))return ERR_PTR (-EBUSY );
Signature · 1 line
2.25.1