Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MdePkg: UefiDevicePathLib: Fix missing the Display Only format of Media Device Path SubType Hard Drive. #6559

Merged
merged 1 commit into from
Dec 25, 2024

Conversation

huangyq13
Copy link
Contributor

HD(Partition,Type,Signature,Start, Size)
HD(Partition,Type,Signature) (Display Only)

Reference: UEFI Specification Version 2.1 (Errata D) (released October 2008)

@lgao4
Copy link
Contributor

lgao4 commented Dec 19, 2024

Please aslo update DevPathFromTextHD ()

@huangyq13
Copy link
Contributor Author

Hi lgao4,

There is no need for updating the DevPathFromTextHD() since the string produced by DevPathToTextHardDrive(XXX, TRUE, XXX) is used for Display Only.

Also, the logic of the DevPathFromTextHD() is similar to the DevPathToTextCDROM() in the current code.

It will definitely return an instance with wrong data if you call the ConvertTextToDevicePath() using a Display Only instance as parameter, because the Display Only instance lacks information.

Check the current code below.

DevPathFromTextCDROM (
   CHAR16 *TextDeviceNode
  )
{
  // ...
  StartStr              = GetNextParamStr (&TextDeviceNode); // This returns a pointer to the "\0", if the TextDeviceNode is Display Only.
  SizeStr               = GetNextParamStr (&TextDeviceNode); // This returns a pointer to the "\0", if the TextDeviceNode is Display Only.
  // ...
  Strtoi64 (StartStr, &CDROMDevPath->PartitionStart); // Get a random PartitionStart value, because Strtoi64 returns an uninitialized local variable.
  Strtoi64 (SizeStr, &CDROMDevPath->PartitionSize); // Get a random PartitionSize, because Strtoi64 returns an uninitialized local variable.

  return (EFI_DEVICE_PATH_PROTOCOL *) CDROMDevPath;
}



@huangyq13
Copy link
Contributor Author

Hi there,

Can we merge this PR? @lgao4 @LiuZhiguang001 @mdkinney

@lgao4 lgao4 added the push Auto push patch series in PR if all checks pass label Dec 25, 2024
Ref: UEFI Specification Version 2.1 (Errata D) (released October 2008)

Signed-off-by: Huang Yuqi <[email protected]>
@mergify mergify bot merged commit 9e65374 into tianocore:master Dec 25, 2024
106 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
push Auto push patch series in PR if all checks pass
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants