mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Tao Chen <chen.dylane@gmail.com>
To: song@kernel.org, jolsa@kernel.org, ast@kernel.org,
	daniel@iogearbox.net, andrii@kernel.org, yonghong.song@linux.dev,
	martin.lau@linux.dev, john.fastabend@gmail.com,
	haoluo@google.com
Cc: bpf@vger.kernel.org, linux-kernel@vger.kernel.org, chen.dylane@gmail.com
Subject: [PATCH] bpf: Use E2BIG instead of ENOENT
Date: Sat,  4 Nov 2023 10:44:44 +0800	[thread overview]
Message-ID: <20231104024444.385484-1-chen.dylane@gmail.com> (raw)

Use E2BIG instead of ENOENT when the key size beyond the buckets size,
it seems more meaningful.

Signed-off-by: Tao Chen <chen.dylane@gmail.com>
---
 kernel/bpf/stackmap.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/bpf/stackmap.c b/kernel/bpf/stackmap.c
index 458bb80b14d5..b78369bdec8d 100644
--- a/kernel/bpf/stackmap.c
+++ b/kernel/bpf/stackmap.c
@@ -570,7 +570,7 @@ int bpf_stackmap_copy(struct bpf_map *map, void *key, void *value)
 	u32 id = *(u32 *)key, trace_len;
 
 	if (unlikely(id >= smap->n_buckets))
-		return -ENOENT;
+		return -E2BIG;
 
 	bucket = xchg(&smap->buckets[id], NULL);
 	if (!bucket)
-- 
2.34.1


             reply	other threads:[~2023-11-04  2:44 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-04  2:44 Tao Chen [this message]
2023-11-04 20:54 ` Alexei Starovoitov
     [not found]   ` <CA+92Ff+ZW5wu3mZFs--nxcyJyc7YxEhP-yuL-BEsWzVChR9Jdg@mail.gmail.com>
2023-11-06 16:13     ` Tao Chen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20231104024444.385484-1-chen.dylane@gmail.com \
    --to=chen.dylane@gmail.com \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=haoluo@google.com \
    --cc=john.fastabend@gmail.com \
    --cc=jolsa@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=martin.lau@linux.dev \
    --cc=song@kernel.org \
    --cc=yonghong.song@linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®