From mboxrd@z Thu Jan 1 00:00:00 1970 From: Thomas Monjalon Subject: Re: [PATCH] eal / malloc : alignment parameter check failing due to changes in rte_is_power_of_2 Date: Fri, 16 Jan 2015 18:01:32 +0100 Message-ID: <1555477.4KJeR5JQaW@xps13> References: <1421421030-22261-1-git-send-email-declan.doherty@intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7Bit Cc: dev-VfR2kkLFssw@public.gmane.org To: Declan Doherty Return-path: In-Reply-To: <1421421030-22261-1-git-send-email-declan.doherty-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org> List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces-VfR2kkLFssw@public.gmane.org Sender: "dev" 2015-01-16 15:10, Declan Doherty: > In commit 2fc8d6d the behaviour of function rte_is_power_of_2 was > changed to not return true for 0. memzone_reserve_aligned_thread_unsafe > and rte_malloc_socket both make the assumption that for align = 0 > !rte_is_power_of_2(align) will return false. This patch adds a check > that align parameter is non-zero before doing the power of 2 check > > Signed-off-by: Declan Doherty [...] > - if (!rte_is_power_of_2(align)) { > + if (align ? !rte_is_power_of_2(align) : 0) { [...] > - if (size == 0 || !rte_is_power_of_2(align)) > + if (size == 0 || align ? !rte_is_power_of_2(align) : 0) I don't understand why you write "align ? !rte_is_power_of_2(align) : 0" instead of the more readable "align && !rte_is_power_of_2(align)" ? Pablo acked it so I guess there is something obvious I'm missing. -- Thomas