lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20160826110209.2d74170b@bbrezillon>
Date:   Fri, 26 Aug 2016 11:02:09 +0200
From:   Boris Brezillon <boris.brezillon@...e-electrons.com>
To:     Artem Bityutskiy <dedekind1@...il.com>,
        Richard Weinberger <richard@....at>
Cc:     David Woodhouse <dwmw2@...radead.org>,
        Brian Norris <computersforpeace@...il.com>,
        linux-mtd@...ts.infradead.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 7/7] UBI: provide helpers to allocate and free aeb
 elements

On Tue, 23 Aug 2016 09:32:54 +0200
Boris Brezillon <boris.brezillon@...e-electrons.com> wrote:

> This not only hides the aeb allocation internals (which is always good in
> case we ever want to change the allocation system), but also helps us
> factorize the initialization of some common fields (ec and pnum).
> 
> Signed-off-by: Boris Brezillon <boris.brezillon@...e-electrons.com>
> ---
>  drivers/mtd/ubi/attach.c  | 68 ++++++++++++++++++++++++++++++++++-------------
>  drivers/mtd/ubi/fastmap.c | 28 +++++++------------
>  drivers/mtd/ubi/ubi.h     |  3 +++
>  drivers/mtd/ubi/vtbl.c    |  4 +--
>  4 files changed, 65 insertions(+), 38 deletions(-)
> 
> diff --git a/drivers/mtd/ubi/attach.c b/drivers/mtd/ubi/attach.c
> index be83c17d742b..ba88ff582f1a 100644
> --- a/drivers/mtd/ubi/attach.c
> +++ b/drivers/mtd/ubi/attach.c
> @@ -182,6 +182,46 @@ static struct ubi_ainf_volume *ubi_find_or_add_av(struct ubi_attach_info *ai,
>  }
>  
>  /**
> + * ubi_alloc_aeb - allocate an aeb element
> + * @ai: attaching information
> + * @aeb: the element to free

The kernel doc is wrong. I'll fix that in v2.

> + *
> + * Allocate an aeb object and initialize the pnum and ec information.
> + * vol_id and lnum are set to UBI_UNKNOWN, and the other fields are
> + * initialized to zero.
> + * Note that the element is not added in any list or RB tree.
> + */
> +struct ubi_ainf_peb *ubi_alloc_aeb(struct ubi_attach_info *ai, int pnum,
> +				   int ec)
> +{
> +	struct ubi_ainf_peb *aeb;
> +
> +	aeb = kmem_cache_zalloc(ai->aeb_slab_cache, GFP_KERNEL);
> +	if (!aeb)
> +		return NULL;
> +
> +	aeb->pnum = pnum;
> +	aeb->ec = ec;
> +	aeb->vol_id = UBI_UNKNOWN;
> +	aeb->lnum = UBI_UNKNOWN;
> +
> +	return aeb;
> +}
> +

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ