From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out-171.mta0.migadu.com (out-171.mta0.migadu.com [91.218.175.171]) (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 D54F7384CEA for ; Thu, 2 Jul 2026 06:16:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.171 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782972986; cv=none; b=W92W0/mFeCGLrfsQl16Zniv5i25Zjl0uCuJRf02h2hc8oR6Da20vHE63gBg+bsP6Yq5NVABi66n1IjNaXt12XsNkSa0ZxkzYFIAHL7vr5b6Ex18t6fR1g8iepcBBAok5JxNlchohjGxTjxD3JF8UNz+ZbBu1+7roniuggOMkmaY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782972986; c=relaxed/simple; bh=y2lWQetm/SsebnOJSE3QoRjhYBxQyq/0WamEDnjb4yY=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=ps7txjiPOO1VsH8xXxCTDkDjHiSEn+E+2lglmyAMWiJXpxp2c/5V9VyMyGGp3pHtQ01GbAzWysKqGsUfzzlyurjY3NBC/69NZtZe5L/CSAIo82olGSQVNoC/4VVRTDW4xwYo43Kg7BrZjG9yMvaGzUgZKg+1Rgr4oeXO/KhymxU= 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=BTMExvYC; arc=none smtp.client-ip=91.218.175.171 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="BTMExvYC" Message-ID: <9b3f954f-fe5f-4aef-b290-30c4f92d4c11@linux.dev> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1782972982; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=XDYLqf+Bz2afmlLc3wTUZI08nGC+yoHSsm0rrmj/GnI=; b=BTMExvYCDuKm8tK3Te+da/XTfM+JPnBCEoiuOEjNspBRj1loKE65JDPq/sZ7LXx7FA64KU SavO6eKU9mU15zAR0hlhTdwkggiNTQC3wUuwzjvEx4xY9lqJUQw4cTtN2pZgeu75T6TOjg Ayq5vl38f8mubywdBYLymr9gLQs5/8E= Date: Thu, 2 Jul 2026 14:16:08 +0800 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Subject: Re: [PATCH bpf-next v8 4/9] libbpf: Add support for global percpu data Content-Language: en-US To: Andrii Nakryiko Cc: bpf@vger.kernel.org, Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Martin KaFai Lau , Eduard Zingerman , Kumar Kartikeya Dwivedi , Song Liu , Yonghong Song , Jiri Olsa , John Fastabend , Quentin Monnet , Shuah Khan , linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, kernel-patches-bot@fb.com References: <20260629152406.52582-1-leon.hwang@linux.dev> <20260629152406.52582-5-leon.hwang@linux.dev> X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Leon Hwang In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Migadu-Flow: FLOW_OUT On 2/7/26 03:32, Andrii Nakryiko wrote: > On Mon, Jun 29, 2026 at 8:25 AM Leon Hwang wrote: [...] >> @@ -1975,7 +1981,7 @@ bpf_object__init_internal_map(struct bpf_object *obj, enum libbpf_map_type type, >> map->sec_idx = sec_idx; >> map->sec_offset = 0; >> map->real_name = strdup(real_name); >> - map->name = internal_map_name(obj, real_name); >> + map->name = is_percpu ? strdup(real_name) : internal_map_name(obj, real_name); > > nit: I'd probably pass type into internal_map_name() and let it handle > all this in one place, consider that for follow up > hmm, it is a true issue that 'map->name' must have the tail '\0'. And strdup(real_name) does not guarantee the tail '\0'. Will pass type into internal_map_name() instead. Thanks, Leon