summaryrefslogtreecommitdiff
path: root/include/hexdump.h
AgeCommit message (Collapse)Author
2025-02-25hexdump: give a different debug log for size==0Peter Jones
Signed-off-by: Peter Jones <pjones@redhat.com>
2021-12-10Minor coverity fixes15.5-rc2Peter Jones
- one missing free - one minor deadcode issue - two unchecked allocations - one debug hexdump of a variable we just freed Signed-off-by: Peter Jones <pjones@redhat.com>
2021-09-07tests: Disable some logging when SHIM_UNIT_TEST is enabledPeter Jones
None of this should ever actually get called when we're running any of the unit tests we've got, but some older compilers (i.e. Centos 7's gcc) fail to remove some of the intermediate functions, and that causes a link error with the functions they call. This patch makes the top level call go away as well, so that the intermediates never have linkage to the underlying implementation functions. Signed-off-by: Peter Jones <pjones@redhat.com>
2021-03-12More va_* workPeter Jones
Be much more explicit about exactly which va_* stuff comes from which ABI in both shim and gnu-efi. This fixes the problem where we see: | (null):0:(null)() v->name:"(null)" v->rtname:"(null)" | (null):0:(null)() v->data_size:0 v->data:0x0 and similar messages where everything is NULL. Signed-off-by: Peter Jones <pjones@redhat.com>
2021-03-10Fix stdarg to work the same everywhere.Peter Jones
This gets us the same working definition for VA_* va_* etc everywhere, and it's the same definition edk2 is using. Signed-off-by: Peter Jones <pjones@redhat.com>
2021-03-10Consolidate most of our standard lib functions to libPeter Jones
Signed-off-by: Peter Jones <pjones@redhat.com>
2021-03-10Restructure our includes.Peter Jones
This re-structures our includes so we can be sure everything is always including all the system headers in a uniform, predictable way. Temporarily it also adds a bunch of junk at all the places we use variadic functions to specifically pick either the MS (cdecl) or ELF ABIs. I'm not 100% sure that's all correct (see later patch) but it's enough to allow this to build. Signed-off-by: Peter Jones <pjones@redhat.com>
2021-02-16Fix up a bunch of our license statements and add SPDX most placesPeter Jones
The license statements in our source files were getting to be a giant mess, and mostly they all just say the same thing. I've switched most of it to SPDX labels, but left copyright statements in place (where they were not obviously incorrect copy-paste jobs that I did...). If there's some change here you don't think is valid, let me know and we can fix it up together. Signed-off-by: Peter Jones <pjones@redhat.com>
2021-01-29Work around some clang-format oddnessesPeter Jones
In the version of clang-format I've got locally[0], WhitespaceSensitiveMacros seems to only work sometimes. That means that if we ever run it on some particular things, it could seriously mess up a bunch of our debugging output. That's not great. In this patch, I've gone ahead and run clang-format on all the macros that use __LINE__, which are the obvious places this is dangerous, and then audited the result and fixed anything that's broken (including a couple of places where it was already broken.) [0] random:~/devel/github.com/shim/clang-format$ clang-format --version clang-format version 11.0.0 (Fedora 11.0.0-2.fc33) Signed-off-by: Peter Jones <pjones@redhat.com>
2020-10-15hexdump.h: fix arithmetic error.Peter Jones
When I modified the hexdumper to help debug MokListRT mirroring not working because of PcdMaxVolatileVariableSize being tiny, I inadvertently added something that is effectively: hexdump(..., char *buf, ..., int position) { unsigned long begin = (position % 16); unsigned long i; ... for (i = 0; i < begin; i++) { ... } ... } Unfortunately, in c if 0x8 is set in position, that means begin is 0xfffffffffffff8, because signed integer math is horrifying: include/hexdump.h:99:vhexdumpf() &data[offset]:0x9E77E6BC size-offset:0x14 include/hexdump.h:15:prepare_hex() position:0x9E77E6BC include/hexdump.h:17:prepare_hex() before:0xFFFFFFFFFFFFFFFC size:0x14 include/hexdump.h:19:prepare_hex() before:0xFFFFFFFFFFFFFFFC after:0x0 include/hexdump.h:21:prepare_hex() buf:0x000000009E77E2BC offset:0 &buf[offset]:0x000000009E77E2BC Woops. This could further have been prevented in /some/ cases by simply not preparing the hexdump buffer when "verbose" is disabled. This patch makes "pos" be unsigned in all cases, and also checks for verbose in vhexdumpf() and simply returns if it is 0. Signed-off-by: Peter Jones <pjones@redhat.com>
2020-07-25Improve debug output somePeter Jones
Signed-off-by: Peter Jones <pjones@redhat.com> Upstream: pr#213
2018-03-12console: Add console_print and console_print_at helpersHans de Goede
This is a preparation commit for removing the setup_console(1) calls from MokManager and shim so that we don't force the EFI console to switch to text-mode. This commit replaces all direct calls to Print / PrintAt with calls to the new helpers (no functional changes) so that we can delay calling setup_console(1) till the first Print call in a follow-up patch. Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2018-03-12Don't use uefi_call_wrapper(), ever.Peter Jones
I'm pretty done with typing uefi_call_wrapper() and counting arguments every time. Instead, just make the compiler error if we don't have ms_abi. Also, make it so nothing can use uefi_call_wrapper() directly. Signed-off-by: Peter Jones <pjones@redhat.com>
2018-03-12Make sure all of our include files have proper guards.Peter Jones
... and make them all the same formatting too. Signed-off-by: Peter Jones <pjones@redhat.com>
2018-03-12Move includes around to clean the source tree up a bit.Peter Jones
Signed-off-by: Peter Jones <pjones@redhat.com>