diff options
| -rw-r--r-- | kernel/bpf/inode.c | 14 | ||||
| -rw-r--r-- | net/xdp/xdp_umem.c | 3 | ||||
| -rw-r--r-- | tools/testing/selftests/bpf/Makefile | 4 |
3 files changed, 15 insertions, 6 deletions
diff --git a/kernel/bpf/inode.c b/kernel/bpf/inode.c index ed13645bd80c..76efe9a183f5 100644 --- a/kernel/bpf/inode.c +++ b/kernel/bpf/inode.c | |||
| @@ -295,6 +295,15 @@ static const struct file_operations bpffs_map_fops = { | |||
| 295 | .release = bpffs_map_release, | 295 | .release = bpffs_map_release, |
| 296 | }; | 296 | }; |
| 297 | 297 | ||
| 298 | static int bpffs_obj_open(struct inode *inode, struct file *file) | ||
| 299 | { | ||
| 300 | return -EIO; | ||
| 301 | } | ||
| 302 | |||
| 303 | static const struct file_operations bpffs_obj_fops = { | ||
| 304 | .open = bpffs_obj_open, | ||
| 305 | }; | ||
| 306 | |||
| 298 | static int bpf_mkobj_ops(struct dentry *dentry, umode_t mode, void *raw, | 307 | static int bpf_mkobj_ops(struct dentry *dentry, umode_t mode, void *raw, |
| 299 | const struct inode_operations *iops, | 308 | const struct inode_operations *iops, |
| 300 | const struct file_operations *fops) | 309 | const struct file_operations *fops) |
| @@ -314,7 +323,8 @@ static int bpf_mkobj_ops(struct dentry *dentry, umode_t mode, void *raw, | |||
| 314 | 323 | ||
| 315 | static int bpf_mkprog(struct dentry *dentry, umode_t mode, void *arg) | 324 | static int bpf_mkprog(struct dentry *dentry, umode_t mode, void *arg) |
| 316 | { | 325 | { |
| 317 | return bpf_mkobj_ops(dentry, mode, arg, &bpf_prog_iops, NULL); | 326 | return bpf_mkobj_ops(dentry, mode, arg, &bpf_prog_iops, |
| 327 | &bpffs_obj_fops); | ||
| 318 | } | 328 | } |
| 319 | 329 | ||
| 320 | static int bpf_mkmap(struct dentry *dentry, umode_t mode, void *arg) | 330 | static int bpf_mkmap(struct dentry *dentry, umode_t mode, void *arg) |
| @@ -322,7 +332,7 @@ static int bpf_mkmap(struct dentry *dentry, umode_t mode, void *arg) | |||
| 322 | struct bpf_map *map = arg; | 332 | struct bpf_map *map = arg; |
| 323 | 333 | ||
| 324 | return bpf_mkobj_ops(dentry, mode, arg, &bpf_map_iops, | 334 | return bpf_mkobj_ops(dentry, mode, arg, &bpf_map_iops, |
| 325 | map->btf ? &bpffs_map_fops : NULL); | 335 | map->btf ? &bpffs_map_fops : &bpffs_obj_fops); |
| 326 | } | 336 | } |
| 327 | 337 | ||
| 328 | static struct dentry * | 338 | static struct dentry * |
diff --git a/net/xdp/xdp_umem.c b/net/xdp/xdp_umem.c index b9ef487c4618..f47abb46c587 100644 --- a/net/xdp/xdp_umem.c +++ b/net/xdp/xdp_umem.c | |||
| @@ -204,7 +204,8 @@ static int xdp_umem_pin_pages(struct xdp_umem *umem) | |||
| 204 | long npgs; | 204 | long npgs; |
| 205 | int err; | 205 | int err; |
| 206 | 206 | ||
| 207 | umem->pgs = kcalloc(umem->npgs, sizeof(*umem->pgs), GFP_KERNEL); | 207 | umem->pgs = kcalloc(umem->npgs, sizeof(*umem->pgs), |
| 208 | GFP_KERNEL | __GFP_NOWARN); | ||
| 208 | if (!umem->pgs) | 209 | if (!umem->pgs) |
| 209 | return -ENOMEM; | 210 | return -ENOMEM; |
| 210 | 211 | ||
diff --git a/tools/testing/selftests/bpf/Makefile b/tools/testing/selftests/bpf/Makefile index 607ed8729c06..7a6214e9ae58 100644 --- a/tools/testing/selftests/bpf/Makefile +++ b/tools/testing/selftests/bpf/Makefile | |||
| @@ -16,9 +16,7 @@ LDLIBS += -lcap -lelf -lrt -lpthread | |||
| 16 | TEST_CUSTOM_PROGS = $(OUTPUT)/urandom_read | 16 | TEST_CUSTOM_PROGS = $(OUTPUT)/urandom_read |
| 17 | all: $(TEST_CUSTOM_PROGS) | 17 | all: $(TEST_CUSTOM_PROGS) |
| 18 | 18 | ||
| 19 | $(TEST_CUSTOM_PROGS): urandom_read | 19 | $(TEST_CUSTOM_PROGS): $(OUTPUT)/%: %.c |
| 20 | |||
| 21 | urandom_read: urandom_read.c | ||
| 22 | $(CC) -o $(TEST_CUSTOM_PROGS) -static $< -Wl,--build-id | 20 | $(CC) -o $(TEST_CUSTOM_PROGS) -static $< -Wl,--build-id |
| 23 | 21 | ||
| 24 | # Order correspond to 'make run_tests' order | 22 | # Order correspond to 'make run_tests' order |
