[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <66030ac1e78fd_4a98a29415@dwillia2-mobl3.amr.corp.intel.com.notmuch>
Date: Tue, 26 Mar 2024 10:49:53 -0700
From: Dan Williams <dan.j.williams@...el.com>
To: Dan Williams <dan.j.williams@...el.com>, <peterz@...radead.org>,
<torvalds@...ux-foundation.org>
CC: Bjorn Helgaas <bhelgaas@...gle.com>, Ira Weiny <ira.weiny@...el.com>,
Jonathan Cameron <jonathan.cameron@...wei.com>, Jesse Brandeburg
<jesse.brandeburg@...el.com>, Ilpo Järvinen
<ilpo.jarvinen@...ux.intel.com>, Lukas Wunner <lukas@...ner.de>, "Jonathan
Corbet" <corbet@....net>, <linux-pci@...r.kernel.org>,
<linux-kernel@...r.kernel.org>, <gregkh@...uxfoundation.org>,
<linux-doc@...r.kernel.org>
Subject: Re: [PATCH v2] cleanup: Add usage and style documentation
Dan Williams wrote:
[..]
> diff --git a/include/linux/cleanup.h b/include/linux/cleanup.h
> index c2d09bc4f976..8ef2d91c2cbf 100644
> --- a/include/linux/cleanup.h
> +++ b/include/linux/cleanup.h
[..]
> + * When the unwind order matters it requires that variables be defined
> + * mid-function scope rather than at the top of the file. Take the
> + * following example and notice the bug highlighted by "!!":
> + *
> + * ::
> + *
> + * LIST_HEAD(list);
> + * DEFINE_MUTEX(lock);
> + *
> + * struct object {
> + * struct list_head node;
> + * };
> + *
> + * static struct object *alloc_add(void)
> + * {
> + * struct object *obj;
> + *
> + * lockdep_assert_held(&lock);
> + * obj = kfree(sizeof(*obj), GFP_KERNEL);
This should be kzalloc(), and I should note that this example is of the
UNTESTED variety.
Powered by blists - more mailing lists