Skip to content

Commit

Permalink
Fix ipmctl lsa read/write seg fault
Browse files Browse the repository at this point in the history
Signed-off-by: Maciej Plucinski <[email protected]>
  • Loading branch information
mplucins authored and gldiviney committed Feb 13, 2019
1 parent 5c16a36 commit ccca1bc
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions DcpmPkg/driver/Core/Namespace.c
Original file line number Diff line number Diff line change
Expand Up @@ -1390,7 +1390,8 @@ ReadLabelStorageArea(
if ((*ppLsa)->Index[CurrentIndex].pFree[LABELS_TO_FREE_BYTES(AlignPageIndex)] != FREE_BLOCKS_MASK_ALL_SET) {
// Find the label to read
for(PageIndexMask = (*ppLsa)->Index[CurrentIndex].pFree[LABELS_TO_FREE_BYTES(AlignPageIndex)], Index = 0;
Index < NSINDEX_FREE_ALIGN; PageIndexMask >>= 1, Index++) {
(Index < NSINDEX_FREE_ALIGN) && ((AlignPageIndex + Index) < (*ppLsa)->Index[CurrentIndex].NumberOfLabels);
PageIndexMask >>= 1, Index++) {
if (BIT0 != (PageIndexMask & BIT0)) {
// Calculate the offest to read, one label per read only
Offset = (UINT32)(LabelIndexSize + (PageSize * (AlignPageIndex + Index)));
Expand Down Expand Up @@ -1536,7 +1537,8 @@ WriteLabelStorageArea(
if (pLsa->Index[CurrentIndex].pFree[LABELS_TO_FREE_BYTES(AlignPageIndex)] != FREE_BLOCKS_MASK_ALL_SET) {
// Find the label to write
for (PageIndexMask = pLsa->Index[CurrentIndex].pFree[LABELS_TO_FREE_BYTES(AlignPageIndex)], Index = 0;
Index < NSINDEX_FREE_ALIGN; PageIndexMask >>= 1, Index++) {
(Index < NSINDEX_FREE_ALIGN) && ((AlignPageIndex + Index) < pLsa->Index[CurrentIndex].NumberOfLabels);
PageIndexMask >>= 1, Index++) {
if (BIT0 != (PageIndexMask & BIT0)) {
// Calculate the offset to write, one label per write only
pFrom = ((UINT8 *)(pLsa->pLabels) + (sizeof(NAMESPACE_LABEL) * (AlignPageIndex + Index)));
Expand Down

0 comments on commit ccca1bc

Please sign in to comment.