Skip to content

Commit e46f25f

Browse files
AlisonSchofielddavejiang
authored andcommitted
cxl/region: Test CXL_DECODER_F_NORMALIZED_ADDRESSING as a bitmask
The CXL decoder flags are defined as bitmasks, not bit indices. Using test_bit() to check them interprets the mask value as a bit index, which is the wrong test. For CXL_DECODER_F_NORMALIZED_ADDRESSING the test reads beyond the flags word, making the flag sometimes appear set and blocking creation of CXL region debugfs attributes that support poison operations. Replace test_bit() with a bitmask check. Found with cxl-test. Fixes: 208f432 ("cxl: Disable HPA/SPA translation handlers for Normalized Addressing") Signed-off-by: Alison Schofield <alison.schofield@intel.com> Reviewed-by: Gregory Price <gourry@gourry.net> Tested-by: Gregory Price <gourry@gourry.net> Link: https://patch.msgid.link/63fe4a6203e40e404347f1cdc7a1c55cb4959b86.1771873256.git.alison.schofield@intel.com Signed-off-by: Dave Jiang <dave.jiang@intel.com>
1 parent 0a70b7c commit e46f25f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/cxl/core/region.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1105,7 +1105,7 @@ static void cxl_region_setup_flags(struct cxl_region *cxlr,
11051105
clear_bit(CXL_REGION_F_NEEDS_RESET, &cxlr->flags);
11061106
}
11071107

1108-
if (test_bit(CXL_DECODER_F_NORMALIZED_ADDRESSING, &cxld->flags))
1108+
if (cxld->flags & CXL_DECODER_F_NORMALIZED_ADDRESSING)
11091109
set_bit(CXL_REGION_F_NORMALIZED_ADDRESSING, &cxlr->flags);
11101110
}
11111111

0 commit comments

Comments
 (0)