[PATCH 5.8 228/464] bpfilter: Initialize pos variable
From: Greg Kroah-Hartman
Date: Mon Aug 17 2020 - 11:31:11 EST
From: Alexei Starovoitov <ast@xxxxxxxxxx>
[ Upstream commit a4fa458950b40d3849946daa32466392811a3716 ]
Make sure 'pos' is initialized to zero before calling kernel_write().
Fixes: d2ba09c17a06 ("net: add skeleton of bpfilter kernel module")
Signed-off-by: Alexei Starovoitov <ast@xxxxxxxxxx>
Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>
---
net/bpfilter/bpfilter_kern.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/net/bpfilter/bpfilter_kern.c b/net/bpfilter/bpfilter_kern.c
index 4494ea6056cdb..42b88a92afe95 100644
--- a/net/bpfilter/bpfilter_kern.c
+++ b/net/bpfilter/bpfilter_kern.c
@@ -50,6 +50,7 @@ static int __bpfilter_process_sockopt(struct sock *sk, int optname,
req.len = optlen;
if (!bpfilter_ops.info.pid)
goto out;
+ pos = 0;
n = kernel_write(bpfilter_ops.info.pipe_to_umh, &req, sizeof(req),
&pos);
if (n != sizeof(req)) {
--
2.25.1