From nobody Mon Feb 9 05:58:19 2026 Received: from out-172.mta0.migadu.com (out-172.mta0.migadu.com [91.218.175.172]) (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 7C3A82EC553 for ; Tue, 27 Jan 2026 02:44:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769481882; cv=none; b=fwoG3rQEg8Q9d3uWkj6DLkd5zr8Ku4tLwnttvqJRxiF1dQwXqbK8XvdrncRzUawTL7tktbq11MkmW82TAZLfd79dF5Gg9GgWMv1zUvl5YOB8GxHmD+k9PvPFr5w9IjqL9FX/ehaveScLCWHQDUWk7ydE/0X/+P41RWLyL7ZptF0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769481882; c=relaxed/simple; bh=drngIWW+fAztlwvma0OKHAnuxBd2wbIi7X6i9RJecoE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=LI5G1JupgjqLYhGJEP2dWNJv94qjUaP/c5kQKuFcBfytlGHe+3jEBJhPxtE+sLIVjbfXM+fk8J8e5GEOtJ4C64KZ/j0R0u8HglfRWGq/kfMzE6WoRsRJckQrRjZgrEM/1Y7tSeSQmnQwkLI00+ljC8al4J7Xwq8MIPdvZCNpJNk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=VqQ1tgRF; arc=none smtp.client-ip=91.218.175.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="VqQ1tgRF" X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1769481878; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=prFf4bLkFxmL672PFq9iQpUXEdYH2JnxC6I8++AT3IY=; b=VqQ1tgRFsg9DAgp80I7caK5fAICVmELmNdTF3Zfbr0DSK81FtixqJsAebJ1U9YfHuIkQ4t 60z0NHIBhH9awJ7ue48VxidiZgdzn3sQ96nCcnN2Pj6SPvLGFTwlndFkXlGYwe1r48iJZH HOoR42cTjeMrewVKEgocLz1xOVH+Tek= From: Roman Gushchin To: bpf@vger.kernel.org Cc: Michal Hocko , Alexei Starovoitov , Matt Bobrowski , Shakeel Butt , JP Kobryn , linux-kernel@vger.kernel.org, linux-mm@kvack.org, Suren Baghdasaryan , Johannes Weiner , Andrew Morton , Roman Gushchin Subject: [PATCH bpf-next v3 03/17] libbpf: fix return value on memory allocation failure Date: Mon, 26 Jan 2026 18:44:06 -0800 Message-ID: <20260127024421.494929-4-roman.gushchin@linux.dev> In-Reply-To: <20260127024421.494929-1-roman.gushchin@linux.dev> References: <20260127024421.494929-1-roman.gushchin@linux.dev> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Migadu-Flow: FLOW_OUT Content-Type: text/plain; charset="utf-8" bpf_map__attach_struct_ops() returns -EINVAL instead of -ENOMEM on the memory allocation failure. Fix it. Fixes: 590a00888250 ("bpf: libbpf: Add STRUCT_OPS support") Signed-off-by: Roman Gushchin Acked-by: Yafang Shao --- tools/lib/bpf/libbpf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c index 0c8bf0b5cce4..46d2762f5993 100644 --- a/tools/lib/bpf/libbpf.c +++ b/tools/lib/bpf/libbpf.c @@ -13480,7 +13480,7 @@ struct bpf_link *bpf_map__attach_struct_ops(const s= truct bpf_map *map) =20 link =3D calloc(1, sizeof(*link)); if (!link) - return libbpf_err_ptr(-EINVAL); + return libbpf_err_ptr(-ENOMEM); =20 /* kern_vdata should be prepared during the loading phase. */ err =3D bpf_map_update_elem(map->fd, &zero, map->st_ops->kern_vdata, 0); --=20 2.52.0