mirror of
https://git.proxmox.com/git/efi-boot-shim
synced 2025-08-05 09:42:26 +00:00
Make sure MIN() and MAX() are always defined.
Signed-off-by: Peter Jones <pjones@redhat.com>
This commit is contained in:
parent
8537e0555c
commit
9c64b6278c
@ -149,5 +149,8 @@
|
||||
#define ALIGN_DOWN(x, a) __ALIGN((x) - ((a) - 1), (a))
|
||||
#endif
|
||||
|
||||
#define MIN(a, b) ({(a) < (b) ? (a) : (b);})
|
||||
#define MAX(a, b) ({(a) <= (b) ? (b) : (a);})
|
||||
|
||||
#endif /* !COMPILER_H_ */
|
||||
// vim:fenc=utf-8:tw=75:et
|
||||
|
@ -213,7 +213,7 @@ console_print_box_at(CHAR16 *str_arr[], int highlight,
|
||||
if (col < 0)
|
||||
col = 0;
|
||||
|
||||
CopyMem(Line + col + 1, s, min(len, size_cols - 2)*2);
|
||||
CopyMem(Line + col + 1, s, MIN(len, size_cols - 2)*2);
|
||||
}
|
||||
if (line >= 0 && line == highlight)
|
||||
co->SetAttribute(co, EFI_LIGHTGRAY |
|
||||
|
4
mok.c
4
mok.c
@ -253,7 +253,7 @@ mirror_one_esl(CHAR16 *name, EFI_GUID *guid, UINT32 attrs,
|
||||
SIZE_T howmany, varsz = 0, esdsz;
|
||||
UINT8 *var, *data;
|
||||
|
||||
howmany = min((maxsz - sizeof(*esl)) / esl->SignatureSize,
|
||||
howmany = MIN((maxsz - sizeof(*esl)) / esl->SignatureSize,
|
||||
(esl->SignatureListSize - sizeof(*esl)) / esl->SignatureSize);
|
||||
if (howmany < 1) {
|
||||
return EFI_BUFFER_TOO_SMALL;
|
||||
@ -411,7 +411,7 @@ mirror_mok_db(CHAR16 *name, CHAR8 *name8, EFI_GUID *guid, UINT32 attrs,
|
||||
|
||||
SIZE_T howmany;
|
||||
UINTN adj = 0;
|
||||
howmany = min((max_var_sz - sizeof(*esl)) / esl->SignatureSize,
|
||||
howmany = MIN((max_var_sz - sizeof(*esl)) / esl->SignatureSize,
|
||||
(esl->SignatureListSize - sizeof(*esl)) / esl->SignatureSize);
|
||||
if (!only_first && i == 0 && howmany >= 1) {
|
||||
adj = howmany * esl->SignatureSize;
|
||||
|
5
shim.h
5
shim.h
@ -35,8 +35,6 @@
|
||||
|
||||
#define nonnull(...) __attribute__((__nonnull__(__VA_ARGS__)))
|
||||
|
||||
#define min(a, b) ({(a) < (b) ? (a) : (b);})
|
||||
|
||||
#ifdef __x86_64__
|
||||
#ifndef DEFAULT_LOADER
|
||||
#define DEFAULT_LOADER L"\\grubx64.efi"
|
||||
@ -233,7 +231,4 @@ verify_buffer (char *data, int datasize,
|
||||
#define LogError(fmt, ...) \
|
||||
LogError_(__FILE__, __LINE__ - 1, __func__, fmt, ##__VA_ARGS__)
|
||||
|
||||
#define MIN(a, b) (((a) <= (b))?(a):(b))
|
||||
#define MAX(a, b) (((a) <= (b))?(b):(a))
|
||||
|
||||
#endif /* SHIM_H_ */
|
||||
|
Loading…
Reference in New Issue
Block a user