Fix errors reported by kernel test robot.
v2:
- move "struct sock *sk = (struct sock *)msk;" into "#ifdef CONFIG_BPF_SYSCALL" too.
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202308240536.xHdtOcPf-lkp@intel.com/
Signed-off-by: Geliang Tang <geliang.tang@suse.com>
---
include/net/bpf_sk_storage.h | 2 +-
net/mptcp/sched.c | 12 ++++++++----
2 files changed, 9 insertions(+), 5 deletions(-)
diff --git a/include/net/bpf_sk_storage.h b/include/net/bpf_sk_storage.h
index 805142d59d02..4251c8158b9d 100644
--- a/include/net/bpf_sk_storage.h
+++ b/include/net/bpf_sk_storage.h
@@ -60,7 +60,7 @@ static inline int bpf_sk_storage_diag_put(struct bpf_sk_storage_diag *diag,
{
return 0;
}
-struct bpf_local_storage_data *
+static inline struct bpf_local_storage_data *
bpf_sk_storage_lookup(struct sock *sk, struct bpf_map *map, bool cacheit_lockit)
{
return NULL;
diff --git a/net/mptcp/sched.c b/net/mptcp/sched.c
index 067df28899a6..54345f753b1a 100644
--- a/net/mptcp/sched.c
+++ b/net/mptcp/sched.c
@@ -203,11 +203,12 @@ mptcp_subflow_ctx_by_pos(const struct mptcp_sched_data *data, unsigned int pos)
int mptcp_sched_get_params(struct mptcp_sock *msk)
{
- struct sock *sk = (struct sock *)msk;
-
if (msk->sched == &mptcp_sched_default)
return msk->snd_burst;
+#ifdef CONFIG_BPF_SYSCALL
+ struct sock *sk = (struct sock *)msk;
+
if (sk->sk_bpf_storage && sk->sk_bpf_storage->smap &&
!strcmp(sk->sk_bpf_storage->smap->map.name, "mptcp_burst_map")) {
struct bpf_local_storage_data *sdata;
@@ -223,19 +224,21 @@ int mptcp_sched_get_params(struct mptcp_sock *msk)
return ptr->snd_burst;
}
}
+#endif
return 0;
}
int mptcp_sched_set_params(struct mptcp_sock *msk, int burst)
{
- struct sock *sk = (struct sock *)msk;
-
if (msk->sched == &mptcp_sched_default) {
msk->snd_burst = burst;
return 0;
}
+#ifdef CONFIG_BPF_SYSCALL
+ struct sock *sk = (struct sock *)msk;
+
if (sk->sk_bpf_storage && sk->sk_bpf_storage->smap &&
!strcmp(sk->sk_bpf_storage->smap->map.name, "mptcp_burst_map")) {
struct bpf_local_storage_data *sdata;
@@ -253,6 +256,7 @@ int mptcp_sched_set_params(struct mptcp_sock *msk, int burst)
}
}
}
+#endif
return 0;
}
--
2.35.3