mirror of
https://git.savannah.gnu.org/git/grub.git
synced 2026-10-21 06:49:35 +00:00
* grub-core/net/netbuff.c (grub_netbuff_alloc): Ensure proper alignment.
This commit is contained in:
1 parent
564840dc3d
commit
f138623a60
2 files changed
+8
-1
No files matched your search
@@ -1,3 +1,7 @@
|
|||||||
|
2011-12-13 Vladimir Serbinenko <phcoder@gmail.com>
|
||||||
|
|
||||||
|
* grub-core/net/netbuff.c (grub_netbuff_alloc): Ensure proper alignment.
|
||||||
|
|
||||||
2011-12-13 Vladimir Serbinenko <phcoder@gmail.com>
|
2011-12-13 Vladimir Serbinenko <phcoder@gmail.com>
|
||||||
|
|
||||||
* grub-core/disk/mdraid_linux.c (grub_mdraid_detect): Change pointer
|
* grub-core/disk/mdraid_linux.c (grub_mdraid_detect): Change pointer
|
||||||
|
|||||||
@@ -78,6 +78,8 @@ grub_netbuff_alloc (grub_size_t len)
|
|||||||
struct grub_net_buff *nb;
|
struct grub_net_buff *nb;
|
||||||
void *data;
|
void *data;
|
||||||
|
|
||||||
|
COMPILE_TIME_ASSERT (NETBUFF_ALIGN % sizeof (grub_properly_aligned_t) == 0);
|
||||||
|
|
||||||
if (len < NETBUFFMINLEN)
|
if (len < NETBUFFMINLEN)
|
||||||
len = NETBUFFMINLEN;
|
len = NETBUFFMINLEN;
|
||||||
|
|
||||||
@@ -85,7 +87,8 @@ grub_netbuff_alloc (grub_size_t len)
|
|||||||
data = grub_memalign (NETBUFF_ALIGN, len + sizeof (*nb));
|
data = grub_memalign (NETBUFF_ALIGN, len + sizeof (*nb));
|
||||||
if (!data)
|
if (!data)
|
||||||
return NULL;
|
return NULL;
|
||||||
nb = (struct grub_net_buff *) ((grub_uint8_t *) data + len);
|
nb = (struct grub_net_buff *) ((grub_properly_aligned_t *) data
|
||||||
|
+ len / sizeof (grub_properly_aligned_t));
|
||||||
nb->head = nb->data = nb->tail = data;
|
nb->head = nb->data = nb->tail = data;
|
||||||
nb->end = (char *) nb;
|
nb->end = (char *) nb;
|
||||||
return nb;
|
return nb;
|
||||||
|
|||||||
Reference in new issue
Block a user