Skip to content

Commit 0778617

Browse files
committed
Fix sfdp_find_addr_region algorithm
1 parent 0db72d0 commit 0778617

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

drivers/source/SFDP.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -387,10 +387,10 @@ int sfdp_find_addr_region(bd_size_t offset, const sfdp_hdr_info &sfdp_info)
387387
return 0;
388388
}
389389

390-
for (int idx = sfdp_info.smptbl.region_cnt - 2; idx >= 0; idx--) {
390+
for (int idx = 0; idx < sfdp_info.smptbl.region_cnt; idx++) {
391391

392-
if (offset > sfdp_info.smptbl.region_high_boundary[idx]) {
393-
return (idx + 1);
392+
if (offset <= sfdp_info.smptbl.region_high_boundary[idx]) {
393+
return idx;
394394
}
395395
}
396396
return -1;

0 commit comments

Comments
 (0)