Commit Graph

3 Commits

Author SHA1 Message Date
Ed Maste
6decf2ccbb libefivar: use standard 2-Clause FreeBSD license
Approved by:	imp
Sponsored by:	The FreeBSD Foundation
2018-03-02 15:12:18 +00:00
Warner Losh
8af6a2c64e Define StrCmp in a funky was to be bug-compatible with EDK2 code.
Paper over a coverity issue:

*** CID 1372592:  API usage errors  (BAD_COMPARE)
/lib/libefivar/efivar-dp-parse.c: 2723 in DevPathFromTextiSCSI()
   Truncating the result of "strcmp" to "unsigned short" may cause it
   to be misinterpreted as 0. Note that "strcmp" may return an integer
   besides -1, 0, or 1.

We do this by making StrCmp return either 0 or 1 for equal or
not-equal.  There's a bug in the DevPathFromTextiSCSI cast of the
return value and this workaround will fix it without breaking other
users of StrCmp (all of which test for == 0).

https://bugzilla.tianocore.org/show_bug.cgi?id=440 has been filed
upstream to log this issue.

CID: 1372592
Sponsored by: Netflix
2017-03-23 02:30:52 +00:00
Warner Losh
7270962aa5 Bring in EDK2 routines for printing and parsing device paths.
This commit implements the (mostly?) Linux compatible
efidp_format_device_path and efidp_parse_device_path APIs. These are
the only APIs exposed through this library. However, they are built on
code from Tianocore's EDK2 MdePkg. They are brought in as new files
here for reasons described in FreeBSD-update.

Symbol versioning will be introduced to control what's exported from
the EDK2 code.

Some structural changes may be necessary when we move to sharing with
sys/boot/efi.

Sponsored by: Netflix
2017-03-09 00:31:31 +00:00