From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pg1-f177.google.com (mail-pg1-f177.google.com [209.85.215.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B7E1928640B for ; Fri, 17 Jul 2026 04:01:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.177 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784260862; cv=none; b=idNF3lN5kYowvFg4k8oYM0oJ9bwiob1dLml4s+7+nYLBQI1052aQSgPl4nCIpnv14TamuyjbpVX8jh4aDp2Ig2u1b7ZWSu6dj1qXPi+g9AQURYab2h99zqC2nsdzwxupm5DGBW1gxPsKgacYP0AES7KbjhryVvaJJi6JzVi6caI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784260862; c=relaxed/simple; bh=vZfpz8uLTiddyiy2758yPAkaK8sMzr6eGQmJvvhq2/8=; h=Mime-Version:Content-Type:Date:Message-Id:Subject:From:To: References:In-Reply-To; b=O0zMSFGg6E9iGG4UcRSQIpHkSIVclk8U1Pqny8ix4mcu3v68+YZ6YkSMoMON+YUH+7OT41MT8tN1aWW4QQ45BiUXCe5TL/PfT04KyKNLFU5Ncz0IRKRaJ23U5Kda7grlGowVANJNbwfdw9P3RxdQBu4OK87NS5LNQU8B7HkPGMA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=etsalapatis.com; spf=pass smtp.mailfrom=etsalapatis.com; dkim=pass (2048-bit key) header.d=etsalapatis-com.20251104.gappssmtp.com header.i=@etsalapatis-com.20251104.gappssmtp.com header.b=EScVKou4; arc=none smtp.client-ip=209.85.215.177 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=etsalapatis.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=etsalapatis.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=etsalapatis-com.20251104.gappssmtp.com header.i=@etsalapatis-com.20251104.gappssmtp.com header.b="EScVKou4" Received: by mail-pg1-f177.google.com with SMTP id 41be03b00d2f7-c966b9ee9cbso4355798a12.1 for ; Thu, 16 Jul 2026 21:01:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=etsalapatis-com.20251104.gappssmtp.com; s=20251104; t=1784260860; x=1784865660; darn=vger.kernel.org; h=in-reply-to:references:to:from:subject:message-id:date:content-type :content-transfer-encoding:mime-version:from:to:cc:subject:date :message-id:reply-to:content-type; bh=ECn3aQ1MYJJkJ62EqF+UNDdIzKP6oCJyMvtDCwa3GgY=; b=EScVKou4Sc7MgkGv5nQFqG1/IWz+0KKZPCRzL0rhRMlZRnmTO60O0LNr7E7EgO74Gq lBYVO8a/y9my7S/iyoyHgAm1ZAaGSnfdfaIYGorOdO5ZCJMEzgio9c/ezXhz+WlgwpF5 MdEKxQrGFgtLqRKgEHfUAQw/VU6TZuimZ8v+40S3UPGpzBfojCMwTyjHTPjg/Cec8EdU 9hwM6+QrUP0lhKWPM93EkPw2sW2BsRzKYIFRu6lg8/t+YeXCR0ppvaDCRNPTtbqUvbb1 wc8uxqAsXiH5mLxg+opitFYeMDUunjtMNAiww0hlLGThv0zyHUya/FQGMFn50kGfPtRF fLfg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1784260860; x=1784865660; h=in-reply-to:references:to:from:subject:message-id:date:content-type :content-transfer-encoding:mime-version:x-gm-gg:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to:content-type; bh=ECn3aQ1MYJJkJ62EqF+UNDdIzKP6oCJyMvtDCwa3GgY=; b=pBemLGPEO3jzYwO8F4ppibLVDUSCLkJuX/L/Q+4r6lQhdZOi9RMMXZIaxcOTCuD9UV ImQ/mLwu9/wkjcwM/dek0wUnuM2iY5YfTPQ7BoTmHIkaj5VVpZIJ04FBj2PgQbAUoATB ls1i+RVd96mdWwGQ1lkvPh3w9VKGhYmSxh0WnKEqhyWIMIEB9cCXk/2pPzm21nkh0sgB Q0GkRVTFPOGtaUVrBN5wfAeGoiGu1RNejIShprVn7mQAV/dgDPyD2CJ7MGdpC1RTpFgH PINFXBB9hwzSXW01NpmUGb1xJ62QGYJEZBE8C+ZXyySswPqvjLMYdtGFnudqNOHUH5gc Wv6g== X-Forwarded-Encrypted: i=1; AHgh+Rpi5ij53oG2SQkvrPcpOYDfpZKTv6hIRO8VZQp0gOTsEdcc2qbmUwGeHuelqqP+p6RCZCWS34tsQu8mQfI=@vger.kernel.org X-Gm-Message-State: AOJu0YwDLgijkyPMDVhM2Q0GJnqHs9n3xRNtpPZxYCCJf+XyTiQA3aXj V8/HoExr4ntZD/vS5+yxfsdMiq+KppkXljF9KOJOL/tUiBOgOOxqSqYjVDOelGVm48Q= X-Gm-Gg: AfdE7ckc5XGg+nS+jaqVj8kLbm4rz7TcCNUYhAqRLT7Va06A9sz+3rUeUKB5GeePxfv FndeYCVjbfYUeZue9vb8OtACUKbyfLBeMvRz7zAKC62XUD0kAfm+fOX2WkEsZvrI9P2yahc7Fq7 sPRpaX7XfdWRzUAPN7Hm6vdBpF17q7v1Wj6TeqlgysWYc3mo8XyUU81K9quZhaQPUV/DoQlnbzp SuB0jSBhvOYDkVjMjJ9dy1+8Yn2FjPgLBFQsaNOTxBC0G9Lpoep8WL2tJIpufhfEpO7UbFAbucw mUfbt5jpbit/U188EdBXqqhCRToO3lRpiFuJfg2BSr6lv6c42wuHDKqrkzDYYpSFxBdEGRc/8dL vZzeEJYqDIOYq34uuJ4G6+1H08kgHzkvOYUYVplHbOa+1KZk3U1QiSOi+BCEXFCLkSQMx4hOJPk MDNLRwbfOU12FL4FS464imUFAcNGppJ7c= X-Received: by 2002:a05:6a00:430a:b0:848:7ea6:4b03 with SMTP id d2e1a72fcca58-84c295839dcmr728495b3a.75.1784260859953; Thu, 16 Jul 2026 21:00:59 -0700 (PDT) Received: from localhost (107-190-31-17.cpe.teksavvy.com. [107.190.31.17]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-84c2af317c8sm162996b3a.30.2026.07.16.21.00.59 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 16 Jul 2026 21:00:59 -0700 (PDT) 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 Content-Type: text/plain; charset=UTF-8 Date: Fri, 17 Jul 2026 00:00:58 -0400 Message-Id: Subject: Re: [PATCH] libarena/selftests: use ARRAY_SIZE macro in st_asan_buddy.bpf.c From: "Emil Tsalapatis" To: "longlong yan" , , , , , , X-Mailer: aerc 0.20.1 References: <20260716071110.560-1-yanlonglong@kylinos.cn> In-Reply-To: <20260716071110.560-1-yanlonglong@kylinos.cn> On Thu Jul 16, 2026 at 3:11 AM EDT, longlong yan wrote: > The ARRAY_SIZE macro is more compact and more formal in linux source. > > Fixes: b1487dc1b181 ("selftests/bpf: Add selftests for libarena buddy all= ocator") > Signed-off-by: longlong yan > --- > .../selftests/bpf/libarena/selftests/test_asan_buddy.bpf.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/tools/testing/selftests/bpf/libarena/selftests/test_asan_bud= dy.bpf.c b/tools/testing/selftests/bpf/libarena/selftests/test_asan_buddy.b= pf.c > index 3266a28f53d7..9c94a5167a50 100644 > --- a/tools/testing/selftests/bpf/libarena/selftests/test_asan_buddy.bpf.= c > +++ b/tools/testing/selftests/bpf/libarena/selftests/test_asan_buddy.bpf.= c > @@ -163,7 +163,7 @@ __weak int asan_test_buddy_oob(void) > return ret; > } > =20 > - for (i =3D zero; i < sizeof(sizes) / sizeof(sizes[0]) && can_loop; i++)= { > + for (i =3D zero; i < ARRAY_SIZE(sizes) && can_loop; i++) { > barrier_var(i); > ret =3D asan_test_buddy_oob_single(sizes[i]); > if (ret) { > @@ -201,7 +201,7 @@ __weak int asan_test_buddy_uaf(void) > return ret; > } > =20 > - for (i =3D zero; i < sizeof(sizes) / sizeof(sizes[0]) && can_loop; i++)= { > + for (i =3D zero; i < ARRAY_SIZE(sizes) && can_loop; i++) { > barrier_var(i); > ret =3D asan_test_buddy_uaf_single(sizes[i]); > if (ret) { As the bot says, this doesn't compile. The sizeof(array) / sizeof(array[0]) is only present in libarena for selftests, so I it's not worth bringing in the macro or adding extra headers even if it makes the code nicer. pw-bot: cr