All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] bpf: Remove unnecessary assertion on fp_old
@ 2019-12-19 17:57 Aditya Pakki
  2019-12-19 21:26 ` Daniel Borkmann
  0 siblings, 1 reply; 2+ messages in thread
From: Aditya Pakki @ 2019-12-19 17:57 UTC (permalink / raw)
  To: pakki001
  Cc: kjlu, Alexei Starovoitov, Daniel Borkmann, Martin KaFai Lau,
	Song Liu, Yonghong Song, Andrii Nakryiko, netdev, bpf,
	linux-kernel

The two callers of bpf_prog_realloc - bpf_patch_insn_single and
bpf_migrate_filter dereference the struct fp_old, before passing
it to the function. Thus assertion to check fp_old is unnecessary
and can be removed.

Signed-off-by: Aditya Pakki <pakki001@umn.edu>
---
v1: Remove the check on fp_old altogether, as suggested by
Daniel Borkmann and Alexei Starovoitov.
---
 kernel/bpf/core.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/kernel/bpf/core.c b/kernel/bpf/core.c
index 49e32acad7d8..ca010b783687 100644
--- a/kernel/bpf/core.c
+++ b/kernel/bpf/core.c
@@ -222,8 +222,6 @@ struct bpf_prog *bpf_prog_realloc(struct bpf_prog *fp_old, unsigned int size,
 	u32 pages, delta;
 	int ret;
 
-	BUG_ON(fp_old == NULL);
-
 	size = round_up(size, PAGE_SIZE);
 	pages = size / PAGE_SIZE;
 	if (pages <= fp_old->pages)
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH v2] bpf: Remove unnecessary assertion on fp_old
  2019-12-19 17:57 [PATCH v2] bpf: Remove unnecessary assertion on fp_old Aditya Pakki
@ 2019-12-19 21:26 ` Daniel Borkmann
  0 siblings, 0 replies; 2+ messages in thread
From: Daniel Borkmann @ 2019-12-19 21:26 UTC (permalink / raw)
  To: Aditya Pakki
  Cc: kjlu, Alexei Starovoitov, Martin KaFai Lau, Song Liu,
	Yonghong Song, Andrii Nakryiko, netdev, bpf, linux-kernel

On Thu, Dec 19, 2019 at 11:57:35AM -0600, Aditya Pakki wrote:
> The two callers of bpf_prog_realloc - bpf_patch_insn_single and
> bpf_migrate_filter dereference the struct fp_old, before passing
> it to the function. Thus assertion to check fp_old is unnecessary
> and can be removed.
> 
> Signed-off-by: Aditya Pakki <pakki001@umn.edu>

Applied, thanks!

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-12-19 21:26 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-19 17:57 [PATCH v2] bpf: Remove unnecessary assertion on fp_old Aditya Pakki
2019-12-19 21:26 ` Daniel Borkmann

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.