From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 13AC1283686 for ; Wed, 31 Dec 2025 17:12:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767201121; cv=none; b=XP8sxKyCBpPmDf5Xse80NBkIvcFjr3tUwvCZ2wCr43S4ajsH36NWZo4ywVJv0eKx2HWrBOuNTw035wykAClEat7xdPMLsk8mW5KCZM1OneCATY73a4z7chKDpinkvItZ3T6Syt17faXKGS3nibu/znKPJMJ3IQWxQpDkOcY5kwo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767201121; c=relaxed/simple; bh=EeIUCkniL/XYGdmDYf57muJwBa/5z8kso2X0jMa6UXM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=fVkpcoROv78EFPL/2IcBGuFoW6+LDl5JAl9QrMGQia06rjUpBlgy7Qz6LPzY51YLB6O6/x1HUG8CJ5j2Saw9YS07Ybt1GUteAtY7vUdiBfXsCBYm4ZsiRQp5yiGLaF0dl/K/794unOd4lYKBvR6nF4HOmOl3607ilLoSxNf9U/g= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=eBaokqso; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="eBaokqso" Received: by smtp.kernel.org (Postfix) with ESMTPSA id B0EFEC113D0; Wed, 31 Dec 2025 17:12:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1767201120; bh=EeIUCkniL/XYGdmDYf57muJwBa/5z8kso2X0jMa6UXM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eBaokqsoPCvKJ1QiEfh2dRF667E8g5wyJeIfO8xIzWusJxGLjBkj/HYJAsxSSXCZx nyZLEx9Bsyl0B4erKqhjKWWSMapcHNT+SdiEtfgLgaSatZqTdt+sJ+txvKMdPe1Ruf 6KNsMzXxVCYWDcwci5AgZ6rYw7Sdx5hTByh+Gnv8ohyzc88g6b6wSkr2I88suv4Vm7 +FTC1MrE9pNhLhLSTQyIRxdt6i30Tqa9TttKGuWqN+nfi1bQAUAdAITrsg+rC7bSCn Bj3qWGSa6jtSDHCMpvtBKTc2NbDmRYWcfJirKm0O9pOZrwdglaQdIqwVs1F3zADc3g kAJjFQNDjqzVA== From: Puranjay Mohan To: bpf@vger.kernel.org Cc: Puranjay Mohan , Puranjay Mohan , Alexei Starovoitov , Andrii Nakryiko , Daniel Borkmann , Martin KaFai Lau , Eduard Zingerman , Kumar Kartikeya Dwivedi , kernel-team@meta.com Subject: [PATCH bpf-next v2 8/9] bpf: xfrm: drop dead NULL check in bpf_xdp_get_xfrm_state() Date: Wed, 31 Dec 2025 09:08:54 -0800 Message-ID: <20251231171118.1174007-9-puranjay@kernel.org> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20251231171118.1174007-1-puranjay@kernel.org> References: <20251231171118.1174007-1-puranjay@kernel.org> Precedence: bulk X-Mailing-List: bpf@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit As KF_TRUSTED_ARGS is now considered the default for all kfuncs, the opts parameter in bpf_xdp_get_xfrm_state() can never be NULL. Verifier will detect this at load time and will not allow passing NULL to this function. This matches the documentation above the kfunc that says this parameter (opts) Cannot be NULL. Signed-off-by: Puranjay Mohan --- net/xfrm/xfrm_state_bpf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/xfrm/xfrm_state_bpf.c b/net/xfrm/xfrm_state_bpf.c index 2248eda741f8..4180c317f9bc 100644 --- a/net/xfrm/xfrm_state_bpf.c +++ b/net/xfrm/xfrm_state_bpf.c @@ -68,7 +68,7 @@ bpf_xdp_get_xfrm_state(struct xdp_md *ctx, struct bpf_xfrm_state_opts *opts, u32 struct net *net = dev_net(xdp->rxq->dev); struct xfrm_state *x; - if (!opts || opts__sz < sizeof(opts->error)) + if (opts__sz < sizeof(opts->error)) return NULL; if (opts__sz != BPF_XFRM_STATE_OPTS_SZ) { -- 2.47.3