Page MenuHomeFreeBSD

D41301.diff
No OneTemporary

D41301.diff

diff --git a/sys/netlink/netlink_message_parser.h b/sys/netlink/netlink_message_parser.h
--- a/sys/netlink/netlink_message_parser.h
+++ b/sys/netlink/netlink_message_parser.h
@@ -41,12 +41,12 @@
char *base; /* Base allocated memory pointer */
uint32_t offset; /* Currently used offset */
uint32_t size; /* Total buffer size */
-};
+} __aligned(_Alignof(__max_align_t));
static inline void *
lb_alloc(struct linear_buffer *lb, int len)
{
- len = roundup2(len, sizeof(uint64_t));
+ len = roundup2(len, _Alignof(__max_align_t));
if (lb->offset + len > lb->size)
return (NULL);
void *data = (void *)(lb->base + lb->offset);
diff --git a/sys/netlink/netlink_snl.h b/sys/netlink/netlink_snl.h
--- a/sys/netlink/netlink_snl.h
+++ b/sys/netlink/netlink_snl.h
@@ -33,6 +33,7 @@
#include <assert.h>
#include <errno.h>
+#include <stdalign.h>
#include <stddef.h>
#include <stdbool.h>
#include <stdint.h>
@@ -74,7 +75,7 @@
uint32_t offset; /* Currently used offset */
uint32_t size; /* Total buffer size */
struct linear_buffer *next; /* Buffer chaining */
-};
+} __aligned(alignof(__max_align_t));
static inline struct linear_buffer *
lb_init(uint32_t size)
@@ -98,7 +99,7 @@
static inline char *
lb_allocz(struct linear_buffer *lb, int len)
{
- len = roundup2(len, sizeof(uint64_t));
+ len = roundup2(len, alignof(__max_align_t));
if (lb->offset + len > lb->size)
return (NULL);
void *data = (void *)(lb->base + lb->offset);

File Metadata

Mime Type
text/plain
Expires
Wed, Nov 20, 1:26 PM (17 h, 54 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
14739308
Default Alt Text
D41301.diff (1 KB)

Event Timeline