Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
dadigang
Ventoy
Commits
0f3d48b3
"vscode:/vscode.git/clone" did not exist on "e108340c79ff9fb13dedf883cb3746aab4b03250"
Commit
0f3d48b3
authored
Jun 15, 2022
by
longpanda
Browse files
Fix the chain load memory alloc failure in UEFI mode.
parent
61f289aa
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
30 additions
and
12 deletions
+30
-12
GRUB2/MOD_SRC/grub-2.04/grub-core/ventoy/ventoy.c
GRUB2/MOD_SRC/grub-2.04/grub-core/ventoy/ventoy.c
+17
-0
GRUB2/MOD_SRC/grub-2.04/grub-core/ventoy/ventoy_def.h
GRUB2/MOD_SRC/grub-2.04/grub-core/ventoy/ventoy_def.h
+1
-0
GRUB2/MOD_SRC/grub-2.04/grub-core/ventoy/ventoy_linux.c
GRUB2/MOD_SRC/grub-2.04/grub-core/ventoy/ventoy_linux.c
+2
-2
GRUB2/MOD_SRC/grub-2.04/grub-core/ventoy/ventoy_unix.c
GRUB2/MOD_SRC/grub-2.04/grub-core/ventoy/ventoy_unix.c
+2
-2
GRUB2/MOD_SRC/grub-2.04/grub-core/ventoy/ventoy_vhd.c
GRUB2/MOD_SRC/grub-2.04/grub-core/ventoy/ventoy_vhd.c
+2
-2
GRUB2/MOD_SRC/grub-2.04/grub-core/ventoy/ventoy_windows.c
GRUB2/MOD_SRC/grub-2.04/grub-core/ventoy/ventoy_windows.c
+6
-6
No files found.
GRUB2/MOD_SRC/grub-2.04/grub-core/ventoy/ventoy.c
View file @
0f3d48b3
...
@@ -38,6 +38,7 @@
...
@@ -38,6 +38,7 @@
#include <grub/memory.h>
#include <grub/memory.h>
#ifdef GRUB_MACHINE_EFI
#ifdef GRUB_MACHINE_EFI
#include <grub/efi/efi.h>
#include <grub/efi/efi.h>
#include <grub/efi/memory.h>
#endif
#endif
#include <grub/ventoy.h>
#include <grub/ventoy.h>
#include "ventoy_def.h"
#include "ventoy_def.h"
...
@@ -135,6 +136,22 @@ int ventoy_is_efi_os(void)
...
@@ -135,6 +136,22 @@ int ventoy_is_efi_os(void)
return
g_efi_os
;
return
g_efi_os
;
}
}
void
*
ventoy_alloc_chain
(
grub_size_t
size
)
{
void
*
p
=
NULL
;
p
=
grub_malloc
(
size
);
#ifdef GRUB_MACHINE_EFI
if
(
!
p
)
{
p
=
grub_efi_allocate_any_pages
(
GRUB_EFI_BYTES_TO_PAGES
(
size
));
}
#endif
return
p
;
}
static
int
ventoy_arch_mode_init
(
void
)
static
int
ventoy_arch_mode_init
(
void
)
{
{
#ifdef GRUB_MACHINE_EFI
#ifdef GRUB_MACHINE_EFI
...
...
GRUB2/MOD_SRC/grub-2.04/grub-core/ventoy/ventoy_def.h
View file @
0f3d48b3
...
@@ -1206,6 +1206,7 @@ grub_err_t ventoy_cmd_browser_dir(grub_extcmd_context_t ctxt, int argc, char **a
...
@@ -1206,6 +1206,7 @@ grub_err_t ventoy_cmd_browser_dir(grub_extcmd_context_t ctxt, int argc, char **a
grub_err_t
ventoy_cmd_browser_disk
(
grub_extcmd_context_t
ctxt
,
int
argc
,
char
**
args
);
grub_err_t
ventoy_cmd_browser_disk
(
grub_extcmd_context_t
ctxt
,
int
argc
,
char
**
args
);
int
ventoy_get_fs_type
(
const
char
*
fs
);
int
ventoy_get_fs_type
(
const
char
*
fs
);
int
ventoy_img_name_valid
(
const
char
*
filename
,
grub_size_t
namelen
);
int
ventoy_img_name_valid
(
const
char
*
filename
,
grub_size_t
namelen
);
void
*
ventoy_alloc_chain
(
grub_size_t
size
);
#endif
/* __VENTOY_DEF_H__ */
#endif
/* __VENTOY_DEF_H__ */
GRUB2/MOD_SRC/grub-2.04/grub-core/ventoy/ventoy_linux.c
View file @
0f3d48b3
...
@@ -1623,10 +1623,10 @@ grub_err_t ventoy_cmd_linux_chain_data(grub_extcmd_context_t ctxt, int argc, cha
...
@@ -1623,10 +1623,10 @@ grub_err_t ventoy_cmd_linux_chain_data(grub_extcmd_context_t ctxt, int argc, cha
}
}
}
}
chain
=
grub_malloc
(
size
);
chain
=
ventoy_alloc_chain
(
size
);
if
(
!
chain
)
if
(
!
chain
)
{
{
grub_printf
(
"Failed to alloc chain memory size %u
\n
"
,
size
);
grub_printf
(
"Failed to alloc chain
linux
memory size %u
\n
"
,
size
);
grub_file_close
(
file
);
grub_file_close
(
file
);
return
1
;
return
1
;
}
}
...
...
GRUB2/MOD_SRC/grub-2.04/grub-core/ventoy/ventoy_unix.c
View file @
0f3d48b3
...
@@ -1185,10 +1185,10 @@ grub_err_t ventoy_cmd_unix_chain_data(grub_extcmd_context_t ctxt, int argc, char
...
@@ -1185,10 +1185,10 @@ grub_err_t ventoy_cmd_unix_chain_data(grub_extcmd_context_t ctxt, int argc, char
}
}
}
}
chain
=
grub_malloc
(
size
);
chain
=
ventoy_alloc_chain
(
size
);
if
(
!
chain
)
if
(
!
chain
)
{
{
grub_printf
(
"Failed to alloc chain memory size %u
\n
"
,
size
);
grub_printf
(
"Failed to alloc chain
unix
memory size %u
\n
"
,
size
);
grub_file_close
(
file
);
grub_file_close
(
file
);
return
1
;
return
1
;
}
}
...
...
GRUB2/MOD_SRC/grub-2.04/grub-core/ventoy/ventoy_vhd.c
View file @
0f3d48b3
...
@@ -687,10 +687,10 @@ grub_err_t ventoy_cmd_raw_chain_data(grub_extcmd_context_t ctxt, int argc, char
...
@@ -687,10 +687,10 @@ grub_err_t ventoy_cmd_raw_chain_data(grub_extcmd_context_t ctxt, int argc, char
}
}
}
}
chain
=
grub_malloc
(
size
);
chain
=
ventoy_alloc_chain
(
size
);
if
(
!
chain
)
if
(
!
chain
)
{
{
grub_printf
(
"Failed to alloc chain memory size %u
\n
"
,
size
);
grub_printf
(
"Failed to alloc chain
raw
memory size %u
\n
"
,
size
);
grub_file_close
(
file
);
grub_file_close
(
file
);
return
1
;
return
1
;
}
}
...
...
GRUB2/MOD_SRC/grub-2.04/grub-core/ventoy/ventoy_windows.c
View file @
0f3d48b3
...
@@ -1896,10 +1896,10 @@ grub_err_t ventoy_cmd_windows_chain_data(grub_extcmd_context_t ctxt, int argc, c
...
@@ -1896,10 +1896,10 @@ grub_err_t ventoy_cmd_windows_chain_data(grub_extcmd_context_t ctxt, int argc, c
}
}
}
}
chain
=
grub_malloc
(
size
);
chain
=
ventoy_alloc_chain
(
size
);
if
(
!
chain
)
if
(
!
chain
)
{
{
grub_printf
(
"Failed to alloc chain memory size %u
\n
"
,
size
);
grub_printf
(
"Failed to alloc chain
win1
memory size %u
\n
"
,
size
);
grub_file_close
(
file
);
grub_file_close
(
file
);
return
1
;
return
1
;
}
}
...
@@ -2129,10 +2129,10 @@ static grub_err_t ventoy_vlnk_wim_chain_data(grub_file_t wimfile)
...
@@ -2129,10 +2129,10 @@ static grub_err_t ventoy_vlnk_wim_chain_data(grub_file_t wimfile)
}
}
}
}
chain
=
grub_malloc
(
size
);
chain
=
ventoy_alloc_chain
(
size
);
if
(
!
chain
)
if
(
!
chain
)
{
{
grub_printf
(
"Failed to alloc chain memory size %u
\n
"
,
size
);
grub_printf
(
"Failed to alloc chain
win2
memory size %u
\n
"
,
size
);
grub_file_close
(
file
);
grub_file_close
(
file
);
return
1
;
return
1
;
}
}
...
@@ -2294,10 +2294,10 @@ static grub_err_t ventoy_normal_wim_chain_data(grub_file_t wimfile)
...
@@ -2294,10 +2294,10 @@ static grub_err_t ventoy_normal_wim_chain_data(grub_file_t wimfile)
}
}
}
}
chain
=
grub_malloc
(
size
);
chain
=
ventoy_alloc_chain
(
size
);
if
(
!
chain
)
if
(
!
chain
)
{
{
grub_printf
(
"Failed to alloc chain memory size %u
\n
"
,
size
);
grub_printf
(
"Failed to alloc chain
win3
memory size %u
\n
"
,
size
);
grub_file_close
(
file
);
grub_file_close
(
file
);
return
1
;
return
1
;
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment