Hi Jan,
> > Remove the superfluous rootCount variable as it is identical to index.
> > Move the number of handles INFO message (handleCount) inline into
> > the enumeration INFO messages as "Volume ${index+1}/${handleCount}".
> >
> > Signed-off-by: Christian Storm <[email protected]>
> > ---
> > utils.c | 25 +++++++++++--------------
> > 1 file changed, 11 insertions(+), 14 deletions(-)
> >
> > diff --git a/utils.c b/utils.c
> > index ace4689..fbd6411 100644
> > --- a/utils.c
> > +++ b/utils.c
> > @@ -106,7 +106,7 @@ EFI_STATUS get_volumes(VOLUME_DESC **volumes, UINTN
> > *count)
> > EFI_HANDLE *handles = NULL;
> > EFI_GUID sfspGuid = SIMPLE_FILE_SYSTEM_PROTOCOL;
> > UINTN handleCount = 0;
> > - UINTN index, rootCount = 0;
> > + UINTN index = 0;
> >
> > EFI_FILE_HANDLE tmp;
> >
> > @@ -121,7 +121,6 @@ EFI_STATUS get_volumes(VOLUME_DESC **volumes, UINTN
> > *count)
> > ERROR(L"Could not locate handle buffer.\n");
> > return EFI_OUT_OF_RESOURCES;
> > }
> > - INFO(L"Found %d handles for file IO\n\n", handleCount);
> >
> > *volumes = (VOLUME_DESC *)AllocatePool(sizeof(VOLUME_DESC) *
> > handleCount);
> > if (!*volumes) {
> > @@ -156,25 +155,23 @@ EFI_STATUS get_volumes(VOLUME_DESC **volumes, UINTN
> > *count)
> > }
> > devpathstr = DevicePathToStr(devpath);
> >
> > - (*volumes)[rootCount].root = tmp;
> > - (*volumes)[rootCount].devpath = devpath;
> > - (*volumes)[rootCount].fslabel =
> > - get_volume_label((*volumes)[rootCount].root);
> > - (*volumes)[rootCount].fscustomlabel =
> > - get_volume_custom_label((*volumes)[rootCount].root);
> > - INFO(L"Volume %d: ", rootCount);
> > + (*volumes)[index].root = tmp;
> > + (*volumes)[index].devpath = devpath;
> > + (*volumes)[index].fslabel =
> > + get_volume_label((*volumes)[index].root);
> > + (*volumes)[index].fscustomlabel =
> > + get_volume_custom_label((*volumes)[index].root);
> > + INFO(L"Volume %d/%d: ", index+1, handleCount);
> > if (IsOnBootMedium(devpath)) {
> > PrintC(EFI_LIGHTGRAY, L"(On boot medium) ");
> > }
> > PrintC(EFI_LIGHTGRAY, L"%s, LABEL=%s, CLABEL=%s\n",
> > - devpathstr, (*volumes)[rootCount].fslabel,
> > - (*volumes)[rootCount].fscustomlabel);
> > + devpathstr, (*volumes)[index].fslabel,
> > + (*volumes)[index].fscustomlabel);
> >
> > FreePool(devpathstr);
> > -
> > - rootCount++;
> > }
> > - *count = rootCount;
> > + *count = index;
> > return EFI_SUCCESS;
> > }
> >
> >
>
> This is not correct: In case of errors, rootCount will deviate from index.
Sh*t, you're right. Thanks!
Kind regards,
Christian
--
Dr. Christian Storm
Siemens AG, Technology, T RDA IOT SES-DE
Otto-Hahn-Ring 6, 81739 München, Germany
--
You received this message because you are subscribed to the Google Groups "EFI
Boot Guard" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/efibootguard-dev/20210127194002.sle36nssvvzwk5ns%40MD1ZFJVC.ad001.siemens.net.