public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Thomas Gleixner <tglx@linutronix.de>
To: akpm@google.com
Cc: cschan@codeaurora.org, john.stultz@linaro.org,
	LKML <linux-kernel@vger.kernel.org>
Subject: Re: [patch 1/2] debugobjects: extend debugobjects to assert that an object is initialized
Date: Wed, 21 Sep 2011 10:28:02 +0200 (CEST)	[thread overview]
Message-ID: <alpine.LFD.2.02.1109211027210.2723@ionos> (raw)
In-Reply-To: <201109202114.p8KLEpmO023041@wpaz9.hot.corp.google.com>

On Tue, 20 Sep 2011, akpm@google.com wrote:

Back to LKML

> From: Christine Chan <cschan@codeaurora.org>
> Subject: debugobjects: extend debugobjects to assert that an object is initialized
> 
> Add new check (assert_init) to make sure objects are initialized and
> tracked by debugobjects.

When is this function to be called and what problem does it solve
which is not handled by the current code?
 
> +	int (*fixup_assert_init)(void *addr, enum debug_obj_state state);
>  };
>  
>  /**
> + * debug_object_assert_init - debug checks when object should be init-ed
> + * @addr:	address of the object
> + * @descr:	pointer to an object specific debug description structure
> + */
> +void debug_object_assert_init(void *addr, struct debug_obj_descr *descr)
> +{
> +	struct debug_bucket *db;
> +	struct debug_obj *obj;
> +	unsigned long flags;
> +
> +	if (!debug_objects_enabled)
> +		return;
> +
> +	db = get_bucket((unsigned long) addr);
> +
> +	raw_spin_lock_irqsave(&db->lock, flags);
> +
> +	obj = lookup_object(addr, db);
> +	if (!obj) {
> +		raw_spin_unlock_irqrestore(&db->lock, flags);
> +		/*
> +		 * Maybe the object is static.  Let the type specific
> +		 * code decide what to do.
> +		 */
> +		debug_object_fixup(descr->fixup_assert_init, addr,
> +				   ODEBUG_STATE_NOTAVAILABLE);

So what's the point of requiring that function to return a value when
it's unchecked?

Thanks,

	tglx

           reply	other threads:[~2011-09-21  8:28 UTC|newest]

Thread overview: expand[flat|nested]  mbox.gz  Atom feed
 [parent not found: <201109202114.p8KLEpmO023041@wpaz9.hot.corp.google.com>]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=alpine.LFD.2.02.1109211027210.2723@ionos \
    --to=tglx@linutronix.de \
    --cc=akpm@google.com \
    --cc=cschan@codeaurora.org \
    --cc=john.stultz@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox