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

bpf: fix format type mismatch warning

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



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

Format '%u' specifies type 'unsigned int' which is nominally
inconsistent with ntohs() result of promoted type 'unsigned short int'.

Use '%u' for ntohs() result will trigger warnings. Fix them by using
'%hu' for ntohs() result.

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 c96c2b4f
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -340,14 +340,14 @@ bpf_getorigdst_impl(struct sock *sk, int optval, void *user, int *len, int dir)
		}
		memset(sin.sin_zero, 0, sizeof(sin.sin_zero));

		pr_debug("SO_ORIGINAL_DST: %pI4 %u\n",
		pr_debug("SO_ORIGINAL_DST: %pI4 %hu\n",
			 &sin.sin_addr.s_addr, ntohs(sin.sin_port));
		nf_ct_put(ct);

		memcpy(user, &sin, sizeof(sin));
		return 0;
	}
	pr_debug("SO_ORIGINAL_DST: Can't find %pI4/%u-%pI4/%u.\n",
	pr_debug("SO_ORIGINAL_DST: Can't find %pI4/%hu-%pI4/%hu.\n",
		 &tuple.src.u3.ip, ntohs(tuple.src.u.tcp.port),
		 &tuple.dst.u3.ip, ntohs(tuple.dst.u.tcp.port));
	return -ENOENT;