From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id B9AC148AD2; Tue, 11 Nov 2025 01:40:34 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 425C94026D; Tue, 11 Nov 2025 01:40:34 +0100 (CET) Received: from dkmailrelay1.smartsharesystems.com (smartserver.smartsharesystems.com [77.243.40.215]) by mails.dpdk.org (Postfix) with ESMTP id 7C8CF4026A for ; Tue, 11 Nov 2025 01:40:32 +0100 (CET) Received: from smartserver.smartsharesystems.com (smartserver.smartsharesys.local [192.168.4.10]) by dkmailrelay1.smartsharesystems.com (Postfix) with ESMTP id 32E4E206DC; Tue, 11 Nov 2025 01:40:32 +0100 (CET) Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Subject: RE: [PATCH v2] lib/ring: do not allow zero size ring Date: Tue, 11 Nov 2025 01:40:29 +0100 Message-ID: <98CBD80474FA8B44BF855DF32C47DC35F65555@smartserver.smartshare.dk> X-MimeOLE: Produced By Microsoft Exchange V6.5 In-Reply-To: <20251110231546.576516-1-iboukris@gmail.com> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [PATCH v2] lib/ring: do not allow zero size ring Thread-Index: AdxSmBoUSnIufZhHTGm5wWMK5PGGdQAClkXQ References: <20251110222827.575488-1-iboukris@gmail.com> <20251110231546.576516-1-iboukris@gmail.com> From: =?iso-8859-1?Q?Morten_Br=F8rup?= To: "Isaac Boukris" , "Honnappa Nagarahalli" , "Konstantin Ananyev" Cc: X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org > diff --git a/lib/ring/rte_ring.c b/lib/ring/rte_ring.c > index edd63aa535..0a9fc31530 100644 > --- a/lib/ring/rte_ring.c > +++ b/lib/ring/rte_ring.c > @@ -47,7 +47,7 @@ EAL_REGISTER_TAILQ(rte_ring_tailq) > RING_F_MP_HTS_ENQ | RING_F_MC_HTS_DEQ) >=20 > /* true if x is a power of 2 */ > -#define POWEROF2(x) ((((x)-1) & (x)) =3D=3D 0) > +#define POWEROF2(x) ((x !=3D 0) && (((x)-1) & (x)) =3D=3D 0) Please remove this private macro and use the RTE_IS_POWER_OF_2() macro = from rte_bitops.h instead. With such modification, Acked-by: Morten Br=F8rup app/pdump/main.c also defines a POWEROF2() macro, which could be = replaced by RTE_IS_POWER_OF_2(). But changing that is unrelated to your improvement in this patch, and = should be an independent patch. Not your responsibility to fix that; just mentioning it for someone to = pick it up.