Commit graph

19 commits

Author SHA1 Message Date
Peter Jones
64e26162eb calloc: Make sure we always have an overflow-checking calloc() available
This tries to make sure that everywhere in this source tree, we always have
an appropriate version of calloc() (i.e. grub_calloc(), xcalloc(), etc.)
available, and that they all safely check for overflow and return NULL when
it would occur.

Signed-off-by: Peter Jones <pjones@redhat.com>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
2020-07-29 16:55:47 +02:00
Vladimir Serbinenko
59ec05bcf8 mm: Avoid integer overflow. 2016-02-17 18:09:44 +01:00
Vladimir Serbinenko
45bf8b3a75 * grub-core/kern/mm.c (grub_real_malloc): Decrease cut-off of moving the
pointer to 32K. This is the size of cache element which is the most
	common allocation >1K. This way the pointer is always around blocks
	of 32K and so we keep performance while decreasing fragmentation.
2013-11-18 17:41:37 +01:00
Vladimir Serbinenko
39ff43c579 * grub-core/kern/mm.c (grub_real_malloc): Don't update the pointer to
current memory when allocating large chunks. This significantly
	decreases memory fragmentation.
2013-11-18 16:58:55 +01:00
Vladimir Serbinenko
c6b755df45 * grub-core/kern/mm.c (grub_real_malloc): Use AND rather than MOD
for alignment.
2013-11-08 09:43:26 +01:00
Vladimir Serbinenko
b61599aca4 * grub-core/kern/mm.c (grub_realloc): Don't copy more data than we have. 2013-11-01 14:39:33 +01:00
Vladimir 'phcoder' Serbinenko
1bc783bd39 * grub-core/kern/mm.c (grub_mm_init_region): Skip regions less than
4K before the end.
	Reported by: Leif Lindholm
2013-09-18 20:23:47 +02:00
Vladimir 'phcoder' Serbinenko
fe4c3e7e67 * grub-core/kern/mm.c (grub_mm_init_region): Fix condition for
detecting too small regions.
2013-04-20 17:39:49 +02:00
Vladimir 'phcoder' Serbinenko
774683685f Lift up core size limits on some platforms. Fix potential memory
corruption with big core on small memory systems. Document remaining
	limits.
2013-03-07 08:17:24 +01:00
Vladimir 'phcoder' Serbinenko
0f92dca7ef * grub-core/kern/mm.c (grub_free): Fix agglomerating of free regions. 2012-06-23 00:39:10 +02:00
Vladimir 'phcoder' Serbinenko
3988c4a09f * grub-core/kern/mm.c (get_header_from_pointer): Put a more informative
message on double free. Put the value of magic in case of mismatch.
2012-06-22 23:54:43 +02:00
Vladimir 'phcoder' Serbinenko
c84ba308b5 * grub-core/kern/mm.c: Add missing include of i18n.h
* grub-core/lib/relocator.c: Likewise.
2012-02-03 14:20:31 +01:00
Vladimir 'phcoder' Serbinenko
4a9f8346c9 * grub-core/commands/ls.c: Gettextize.
* grub-core/commands/setpci.c: Likewise.
        * grub-core/commands/videotest.c: Likewise.
        * grub-core/disk/geli.c: Likewise.
        * grub-core/kern/mm.c: Likewise.
        * grub-core/lib/relocator.c: Likewise.
        * grub-core/loader/efi/appleloader.c: Likewise.
        * grub-core/loader/i386/xnu.c: Likewise.
        * grub-core/loader/ia64/efi/linux.c: Likewise.
        * grub-core/loader/xnu.c: Likewise.
        * grub-core/net/dns.c: Likewise.
        * grub-core/net/net.c: Likewise.
        * grub-core/script/lexer.c: Likewise.
        * grub-core/script/parser.y: Likewise.
        * grub-core/script/yylex.l: Likewise.
        * util/getroot.c: Likewise.
        * util/grub-setup.c: Likewise.
2012-02-03 11:56:49 +01:00
Vladimir 'phcoder' Serbinenko
e1a0e1b428 Fix the usage of unsupported %zx 2011-07-06 17:41:19 +02:00
Vladimir 'phcoder' Serbinenko
de04eecfa9 * grub-core/kern/mm.c (grub_memalign): Disable auto-unloadding of
unused modules since currently referrence counter isn't reliable and
	there isn't much memory to recover there anyway.
2011-05-14 22:44:53 +02:00
Vladimir 'phcoder' Serbinenko
04a0a4cdf4 Fix a bug in memory allocation 2010-08-29 00:19:13 +02:00
Vladimir 'phcoder' Serbinenko
4619710a05 Don't try to malloc if grub_mm_base is 0 2010-08-28 11:32:49 +02:00
Vladimir 'phcoder' Serbinenko
16bd6cfab2 Merge mainline into newreloc. For now without boot tests 2010-08-25 03:25:18 +02:00
BVK Chaitanya
8c41176882 automake commit without merge history 2010-05-06 11:34:04 +05:30
Renamed from kern/mm.c (Browse further)