Get rid of NULL pointer dereference
All checks were successful
Builds / ExectOS (amd64) (push) Successful in 37s
Builds / ExectOS (i686) (push) Successful in 37s

This commit is contained in:
Rafal Kupiec 2024-06-09 12:45:01 +02:00
parent 2f16f4f613
commit 3097ff6250
Signed by: belliash
GPG Key ID: 4E829243E0CFE6B4

View File

@ -67,20 +67,17 @@
#define CONCATENATE(Str1, Str2) CONCAT_STRING(Str1, Str2)
/* Macro for accessing the base address of a structure from a structure member */
#define CONTAIN_RECORD(Address, Type, Field) ((Type *)(((ULONG_PTR)Address) - (ULONG_PTR)(&(((Type *)0)->Field))))
#define CONTAIN_RECORD(Address, Type, Field) ((Type *)((char *)(Address) - FIELD_OFFSET(Type, Field)))
/* EFI size to pages conversion macro */
#define EFI_SIZE_TO_PAGES(Size) (((Size) >> EFI_PAGE_SHIFT) + (((Size) & EFI_PAGE_MASK) ? 1 : 0))
/* Macro for calculating byte offset of a field in the structure */
#define FIELD_OFFSET(Structure, Field) ((LONG)(LONG_PTR)&(((Structure *)0)->Field))
#define FIELD_OFFSET(Structure, Field) __builtin_offsetof(Structure, Field)
/* Macro for calculating size of a field in the structure */
#define FIELD_SIZE(Structure, Field) (sizeof(((Structure *)0)->Field))
/* Macro that yields field type in the structure */
#define FIELD_TYPE(Structure, Field) (((Structure*)0)->Field)
/* Macro that page-aligns a virtual address */
#define PAGE_ALIGN(VirtualAddress) ((PVOID)((ULONG_PTR)VirtualAddress & ~MM_PAGE_MASK))