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] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHdPZaOKFfVfr+7Cn3VpmhcgsR9m6eoZn4NrhSoV4YONPt0Qag@mail.gmail.com>
Date:	Sat, 9 Jun 2012 00:54:27 +0530
From:	"devendra.aaru" <devendra.aaru@...il.com>
To:	Linus Walleij <linus.walleij@...aro.org>,
	Dong Aisheng <aisheng.dong@...escale.com>,
	linux-kernel@...r.kernel.org
Cc:	Devendra Naga <devendra.aaru@...il.com>
Subject: Re: [PATCH 1/2] pinctrl: pinctrl-imx: free allocated pinctrl_map
 structure only once and use kernel facilities for IMX_PMX_DUMP

Hi Dong, Linus,

i sent a second patch previously which applies actually on top this
patch , so not sending it.

You want me to send it again?

Thanks,
Devendra.

On Sat, Jun 9, 2012 at 12:52 AM, Devendra Naga <devendra.aaru@...il.com> wrote:
> a) as we allocate the pinctrl_map structure at imx_dt_node_to_map at  line 167, anyway
>   if its an element, or a num_elements * (sizeof(type)) elements allocated to one single
>   pointer must be freed only once.
>
> CASE. A)
>
> as new_map is not moved and allocated like,
>
> for (i = 0; i < MAX_ELEMS; i++) {
>    new_map[i] = kmalloc(numelems * size, GFP_KERNEL);
> }
>
> its freed as
>
> for (i = 0; i < MAX_ELEMS; i++) {
>    kfree(new_map[i]);
> }
>
> CASE. B)
> and its allocated like
>        new_map = kmalloc(numelems * size, GFP_KERNEL);
>
> it just needs kfree not as case A's.
>
> b) use KERN_DEBUG facility for the IMX_PMX_DUMP macro.
>
> Signed-off-by: Devendra Naga <devendra.aaru@...il.com>
> Acked-by: Dong Aisheng <dong.aisheng@...aro.org>
> ---
>  drivers/pinctrl/pinctrl-imx.c |   28 ++++++++++++----------------
>  1 file changed, 12 insertions(+), 16 deletions(-)
>
> diff --git a/drivers/pinctrl/pinctrl-imx.c b/drivers/pinctrl/pinctrl-imx.c
> index f6e7c67..09f3a30 100644
> --- a/drivers/pinctrl/pinctrl-imx.c
> +++ b/drivers/pinctrl/pinctrl-imx.c
> @@ -27,16 +27,16 @@
>  #include "core.h"
>  #include "pinctrl-imx.h"
>
> -#define IMX_PMX_DUMP(info, p, m, c, n)         \
> -{                                              \
> -       int i, j;                               \
> -       printk("Format: Pin Mux Config\n");     \
> -       for (i = 0; i < n; i++) {               \
> -               j = p[i];                       \
> -               printk("%s %d 0x%lx\n",         \
> -                       info->pins[j].name,     \
> -                       m[i], c[i]);            \
> -       }                                       \
> +#define IMX_PMX_DUMP(info, p, m, c, n)                 \
> +{                                                      \
> +       int i, j;                                       \
> +       printk(KERN_DEBUG "Format: Pin Mux Config\n");  \
> +       for (i = 0; i < n; i++) {                       \
> +               j = p[i];                               \
> +               printk(KERN_DEBUG "%s %d 0x%lx\n",      \
> +                       info->pins[j].name,             \
> +                       m[i], c[i]);                    \
> +       }                                               \
>  }
>
>  /* The bits in CONFIG cell defined in binding doc*/
> @@ -201,10 +201,7 @@ static int imx_dt_node_to_map(struct pinctrl_dev *pctldev,
>  static void imx_dt_free_map(struct pinctrl_dev *pctldev,
>                                struct pinctrl_map *map, unsigned num_maps)
>  {
> -       int i;
> -
> -       for (i = 0; i < num_maps; i++)
> -               kfree(map);
> +       kfree(map);
>  }
>
>  static struct pinctrl_ops imx_pctrl_ops = {
> @@ -475,9 +472,8 @@ static int __devinit imx_pinctrl_parse_groups(struct device_node *np,
>                grp->configs[j] = config & ~IMX_PAD_SION;
>        }
>
> -#ifdef DEBUG
>        IMX_PMX_DUMP(info, grp->pins, grp->mux_mode, grp->configs, grp->npins);
> -#endif
> +
>        return 0;
>  }
>
> --
> 1.7.9.5
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ