We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 5aaf6a8 commit 7314166Copy full SHA for 7314166
fs/overlayfs/util.c
@@ -15,6 +15,7 @@
15
#include <linux/uuid.h>
16
#include <linux/namei.h>
17
#include <linux/ratelimit.h>
18
+#include <linux/overflow.h>
19
#include "overlayfs.h"
20
21
/* Get write access to upper mnt - may fail if upper sb was remounted ro */
@@ -145,9 +146,9 @@ void ovl_stack_free(struct ovl_path *stack, unsigned int n)
145
146
147
struct ovl_entry *ovl_alloc_entry(unsigned int numlower)
148
{
- size_t size = offsetof(struct ovl_entry, __lowerstack[numlower]);
149
- struct ovl_entry *oe = kzalloc(size, GFP_KERNEL);
+ struct ovl_entry *oe;
150
151
+ oe = kzalloc(struct_size(oe, __lowerstack, numlower), GFP_KERNEL);
152
if (oe)
153
oe->__numlower = numlower;
154
0 commit comments