mirror of
https://github.com/tbsdtv/linux_media.git
synced 2025-07-23 04:33:26 +02:00
virt: acrn: Replace obsolete memalign() with posix_memalign()
memalign() is obsolete according to its manpage. Replace memalign() with posix_memalign() and remove malloc.h include that was there for memalign(). As a pointer is passed into posix_memalign(), initialize *p to NULL to silence a warning about the function's return value being used as uninitialized (which is not valid anyway because the error is properly checked before p is returned). Signed-off-by: Deming Wang <wangdeming@inspur.com> Link: https://lore.kernel.org/r/20230412073041.2168-1-wangdeming@inspur.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
b56eef3e16
commit
32118bdc94
@@ -13,7 +13,6 @@
|
|||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <malloc.h>
|
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
@@ -54,8 +53,8 @@ int main(int argc, char **argv)
|
|||||||
argc = argc;
|
argc = argc;
|
||||||
argv = argv;
|
argv = argv;
|
||||||
|
|
||||||
guest_memory = memalign(4096, GUEST_MEMORY_SIZE);
|
ret = posix_memalign(&guest_memory, 4096, GUEST_MEMORY_SIZE);
|
||||||
if (!guest_memory) {
|
if (ret < 0) {
|
||||||
printf("No enough memory!\n");
|
printf("No enough memory!\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user