mem: Fix RAM size integer overflow with a not-yet-supported size
This commit is contained in:
@@ -2628,7 +2628,8 @@ mem_init_ram_mapping(mem_mapping_t *mapping, uint32_t base, uint32_t size)
|
|||||||
void
|
void
|
||||||
mem_reset(void)
|
mem_reset(void)
|
||||||
{
|
{
|
||||||
uint32_t c, m;
|
uint32_t c;
|
||||||
|
size_t m;
|
||||||
|
|
||||||
memset(page_ff, 0xff, sizeof(page_ff));
|
memset(page_ff, 0xff, sizeof(page_ff));
|
||||||
|
|
||||||
@@ -2666,7 +2667,7 @@ mem_reset(void)
|
|||||||
mem_size = 2097152;
|
mem_size = 2097152;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
m = 1024UL * mem_size;
|
m = 1024UL * (size_t) mem_size;
|
||||||
|
|
||||||
#if (!(defined __amd64__ || defined _M_X64 || defined __aarch64__ || defined _M_ARM64))
|
#if (!(defined __amd64__ || defined _M_X64 || defined __aarch64__ || defined _M_ARM64))
|
||||||
if (mem_size > 1048576) {
|
if (mem_size > 1048576) {
|
||||||
|
Reference in New Issue
Block a user