MdeModulePkg:Last LBA missed on NvmExpressMediaClear

Off by one error in the code of NvmExpressMediaClear() causes the last
LBA to be missed when clearing the media.

This patch fixes the issue by adjusting the loop condition to ensure
that all LBAs are cleared properly.

Signed-off-by: Sean Brogan <sebrogan@microsoft.com>
This commit is contained in:
Sean Brogan 2026-04-02 14:30:54 -07:00 committed by mergify[bot]
parent ab3097d457
commit 86e285dd21

View file

@ -373,7 +373,7 @@ NvmExpressMediaClear (
// Per NIST 800-88r1, one or more pass of writes may be alteratively used.
//
for (TotalPassCount = 0; TotalPassCount < PassCount; TotalPassCount++) {
for (SectorOffset = 0; SectorOffset < Media->LastBlock; SectorOffset++ ) {
for (SectorOffset = 0; SectorOffset <= Media->LastBlock; SectorOffset++ ) {
Status = Device->BlockIo.WriteBlocks (
&Device->BlockIo,
MediaId,