From 364b2e413c69daf189d2bc0238e3ba9b0dcbd937 Mon Sep 17 00:00:00 2001 From: Lianbo Jiang Date: Mon, 23 May 2022 18:04:13 +0800 Subject: [PATCH 02/16] sbitmapq: remove struct and member validation in sbitmapq_init() Let's remove the struct and member validation from sbitmapq_init(), which will help the crash to display the actual error when the sbitmapq fails. Without the patch: crash> sbitmapq ffff8e99d0dc8010 sbitmapq: command not supported or applicable on this architecture or kernel With the patch: crash> sbitmapq ffff8e99d0dc8010 sbitmapq: invalid structure member offset: sbitmap_queue_alloc_hint FILE: sbitmap.c LINE: 365 FUNCTION: sbitmap_queue_context_load() Signed-off-by: Lianbo Jiang --- sbitmap.c | 24 ------------------------ 1 file changed, 24 deletions(-) diff --git a/sbitmap.c b/sbitmap.c index 96a61e6c2c71..7693eef6cebd 100644 --- a/sbitmap.c +++ b/sbitmap.c @@ -525,30 +525,6 @@ void sbitmapq_init(void) MEMBER_OFFSET_INIT(sbq_wait_state_wait_cnt, "sbq_wait_state", "wait_cnt"); MEMBER_OFFSET_INIT(sbq_wait_state_wait, "sbq_wait_state", "wait"); - if (!VALID_SIZE(sbitmap_word) || - !VALID_SIZE(sbitmap) || - !VALID_SIZE(sbitmap_queue) || - !VALID_SIZE(sbq_wait_state) || - INVALID_MEMBER(sbitmap_word_depth) || - INVALID_MEMBER(sbitmap_word_word) || - INVALID_MEMBER(sbitmap_word_cleared) || - INVALID_MEMBER(sbitmap_depth) || - INVALID_MEMBER(sbitmap_shift) || - INVALID_MEMBER(sbitmap_map_nr) || - INVALID_MEMBER(sbitmap_map) || - INVALID_MEMBER(sbitmap_queue_sb) || - INVALID_MEMBER(sbitmap_queue_alloc_hint) || - INVALID_MEMBER(sbitmap_queue_wake_batch) || - INVALID_MEMBER(sbitmap_queue_wake_index) || - INVALID_MEMBER(sbitmap_queue_ws) || - INVALID_MEMBER(sbitmap_queue_ws_active) || - INVALID_MEMBER(sbitmap_queue_round_robin) || - INVALID_MEMBER(sbitmap_queue_min_shallow_depth) || - INVALID_MEMBER(sbq_wait_state_wait_cnt) || - INVALID_MEMBER(sbq_wait_state_wait)) { - command_not_supported(); - } - sb_flags |= SB_FLAG_INIT; } -- 2.30.2