bsps/xnandpsu: Constrain block erasure to device

The XNandPsu_EraseBlock function takes a target device and a block
offset for erasure. Ensure the block offset is within the size of the
target device.
This commit is contained in:
Kinsey Moore
2023-12-02 20:32:45 -06:00
committed by Joel Sherrill
parent d77a873ddb
commit 437053282d

View File

@@ -2193,7 +2193,11 @@ s32 XNandPsu_EraseBlock(XNandPsu *InstancePtr, u32 Target, u32 Block)
Xil_AssertNonvoid(InstancePtr != NULL);
Xil_AssertNonvoid(InstancePtr->IsReady == XIL_COMPONENT_IS_READY);
Xil_AssertNonvoid(Target < XNANDPSU_MAX_TARGETS);
#ifdef __rtems__
Xil_AssertNonvoid(Block < InstancePtr->Geometry.NumTargetBlocks);
#else
Xil_AssertNonvoid(Block < InstancePtr->Geometry.NumBlocks);
#endif
s32 Status = XST_FAILURE;
u32 Page;