Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F103003241
D41301.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D41301.diff
View Options
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
Details
Attached
Mime Type
text/plain
Expires
Wed, Nov 20, 5:15 PM (18 h, 45 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
14739308
Default Alt Text
D41301.diff (1 KB)
Attached To
Mode
D41301: netlink: Align allocations on __max_align_t, not uint64_t.
Attached
Detach File
Event Timeline
Log In to Comment