From: "Jan Beulich" Subject: Re: [PATCH v3] xmalloc: add support for checking the pool integrity Date: Wed, 10 Dec 2014 12:56:43 +0000 Message-ID: <5488511B020000780004E8CB@mail.emea.novell.com> References: <1418213638-14896-1-git-send-email-mdontu@bitdefender.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1418213638-14896-1-git-send-email-mdontu@bitdefender.com> Content-Disposition: inline List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: =?UTF-8?Q?Mihai=20Don=C8=9Bu?= Cc: keir@xen.org, tim@xen.org, ian.jackson@eu.citrix.com, ian.campbell@citrix.com, xen-devel@lists.xen.org List-Id: xen-devel@lists.xenproject.org >>> On 10.12.14 at 13:13, wrote: > +#define xmem_pool_check_locked(pool) __xmem_pool_check_locked(__FILE__, __LINE__, pool) > +static bool_t __xmem_pool_check_locked(const char *file, int line, const struct xmem_pool *pool) Long lines. > +{ > + int i; unsigned int > + static bool_t once = 1; > + > + if ( !once ) > + goto out; > + for ( i = 0; i < REAL_FLI; i++ ) > + { > + int fl = (pool->fl_bitmap & (1 << i)) ? i : -1; > + > + if ( fl >= 0 ) > + { > + int j; unsigned int > + > + if ( !pool->sl_bitmap[fl] ) > + { > + printk(XENLOG_ERR > + "xmem_pool: %s: the TLSF bitmap is corrupted (non-empty FL with empty SL)\n", For the sake of brevity: "...: TLSF bitmap corrupt (...)\n" (please follow advice given - as for an earlier message - throughout a patch). > + pool->name); > + __warn(file, line); > + once = 0; > + break; > + } > + for ( j = 0; j < MAX_SLI; j++ ) > + { > + int sl = (pool->sl_bitmap[fl] & (1 << j)) ? j : -1; > + > + if ( sl < 0 ) > + continue; > + if ( !pool->matrix[fl][sl] ) > + { > + printk(XENLOG_ERR > + "xmem_pool: %s: the TLSF bitmap is corrupted (matrix[%d][%d] is NULL)\n", > + pool->name, fl, sl); > + __warn(file, line); > + once = 0; > + break; > + } > + if ( !xmem_pool_check_size(pool, fl, sl) ) > + { > + printk(XENLOG_ERR "xmem_pool: %s: the TLSF chunk matrix is corrupted\n", > + pool->name); > + __warn(file, line); > + once = 0; > + break; > + } > + } > + if ( !once ) > + break; > + } > + } > +out: Label should be indented by one space; whether a label is warranted here is questionable though. I thought I gave all these comments on v2 already, but it looks like I accidentally lost them while reducing quoted text. Jan