Page MenuHomeFreeBSD

Fix booting on arm64
ClosedPublic

Authored by andrew on Jan 15 2018, 2:18 PM.
Tags
None
Referenced Files
Unknown Object (File)
Dec 22 2023, 10:58 PM
Unknown Object (File)
Dec 24 2022, 7:31 PM
Subscribers
None

Details

Summary

Fix booting on some arm64 systems after r327879 by fixing the call to
utf8_to_ucs2 in boot1.efi. We need to initialise the ucs2 output string
so it will allocate space, and use the return value to determine if the
call was successful.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

imp added inline comments.
stand/efi/boot1/boot1.c
93 ↗(On Diff #37968)

Why isn't testing uv == NULL sufficient? We always don't change it when there's an error. The bug here is that uv wasn't initialized to NULL like efi_setenv_freebsd_wcs was.

109–111 ↗(On Diff #37968)

We have the same code here.

This revision is now accepted and ready to land.Jan 15 2018, 3:49 PM
stand/efi/boot1/boot1.c
93 ↗(On Diff #37968)

It's allocated at the start of utf8_to_ucs2. I don't see where it's then set to NULL.

109–111 ↗(On Diff #37968)

That also looks wrong, however as utf8_to_ucs2 only seems to fail when the input string is bad I think the error case in either function is unlikely.

stand/efi/boot1/boot1.c
93 ↗(On Diff #37968)

Yea, you're right.... Other code I've written sets it to null and I'd assumed this did too. It should, but doesn't, so this check is right.

109–111 ↗(On Diff #37968)

We should do the same check here of the return value.

See also https://reviews.freebsd.org/D13917, but I think checking the return values is better in both places.

This revision was automatically updated to reflect the committed changes.