From: "Jan Beulich" Subject: Re: [PATCH v2] xmalloc: add support for checking the pool integrity Date: Mon, 08 Dec 2014 10:18:01 +0000 Message-ID: <548588E9020000780004DAF4@mail.emea.novell.com> References: <1418005848-17447-1-git-send-email-mdontu@bitdefender.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1XxvOI-0006bc-Uo for xen-devel@lists.xenproject.org; Mon, 08 Dec 2014 10:18:07 +0000 In-Reply-To: <1418005848-17447-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: xen-devel@lists.xenproject.org List-Id: xen-devel@lists.xenproject.org >>> On 08.12.14 at 03:30, wrote: > +#ifndef NDEBUG > +static bool_t xmem_pool_check_size(const struct bhdr *b, int fl, int sl) > +{ > + while ( b ) > + { > + int __fl; > + int __sl; > + > + MAPPING_INSERT(b->size, &__fl, &__sl); > + if ( __fl != fl || __sl != sl ) > + { > + printk(XENLOG_ERR "xmem_pool: for block %p size = %u, { fl = %d, sl = %d } should be { fl = %d, sl = %d }\n", Quoting my reply to v1: "Long line. Only the format message alone is allowed to exceed 80 characters." Also with there potentially being multiple pools, shouldn't all of the log messages the patch issues be extended to allow identifying the offending one? > +bool_t __xmem_pool_check(const char *file, int line, struct xmem_pool *pool) > +{ > + return __xmem_pool_check_unlocked(file, line, pool ? pool : xenpool); For brevity, the shorter "pool ?: xenpool" is generally preferable. The only place using this is not allowed are the public headers. Jan