Commit effcfff4 authored by Ziyang Xuan's avatar Ziyang Xuan Committed by Dong Chenchen
Browse files

bpf: fix type incompatible warning

hulk inclusion
category: bugfix
bugzilla: 187826, https://gitee.com/openeuler/kernel/issues/I9K8D1



--------------------------------

In bpf_getorigdst_impl(), argument 1 of type 'void *' is not
compatible with argument 2 of type 'struct sockaddr_in *' in
call to function 'memcpy'.

Cast type of argument 2 to 'void *' to fix the warning.

Fixes: 877e893ac68e ("[Huawei] bpf: Add new bpf helper to get SO_ORIGINAL_DST/REPLY_SRC")
Signed-off-by: default avatarZiyang Xuan <william.xuanziyang@huawei.com>
Signed-off-by: default avatarDong Chenchen <dongchenchen2@huawei.com>
parent b3aa7f45
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -344,7 +344,7 @@ bpf_getorigdst_impl(struct sock *sk, int optval, void *user, int *len, int dir)
			 &sin.sin_addr.s_addr, ntohs(sin.sin_port));
		nf_ct_put(ct);

		memcpy(user, &sin, sizeof(sin));
		memcpy(user, (void *)&sin, sizeof(sin));
		return 0;
	}
	pr_debug("SO_ORIGINAL_DST: Can't find %pI4/%hu-%pI4/%hu.\n",