Re: [PATCH] pinctrl:sunplus: Add check for kmalloc

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Le 25/05/2023 à 21:19, Dan Carpenter a écrit :
On Tue, May 23, 2023 at 10:05:49PM +0200, Christophe JAILLET wrote:
Should be looked at more carefully, but
   dt_to_map_one_config		(in /drivers/pinctrl/devicetree.c)
     .dt_node_to_map
       --> sppctl_dt_node_to_map

Should dt_to_map_one_config() fail, pinctrl_dt_free_maps() is called
(see https://elixir.bootlin.com/linux/v6.4-rc1/source/drivers/pinctrl/devicetree.c#L281)

Thanks for this call tree, I don't have this file enabled in my build
so it's not easy for me to find how sppctl_dt_node_to_map() was called.

drivers/pinctrl/devicetree.c
    160                  dev_err(p->dev, "pctldev %s doesn't support DT\n",
    161                          dev_name(pctldev->dev));
    162                  return -ENODEV;
    163          }
    164          ret = ops->dt_node_to_map(pctldev, np_config, &map, &num_maps);
                                                               ^^^^
"map" isn't stored anywhere so it will be leaked.  I guess kmemleak
already figured this out.

    165          if (ret < 0)
    166                  return ret;
    167          else if (num_maps == 0) {
    168                  /*


Hi, thanks Dan for sharing your PoV on this.

CJ




[Index of Archives]     [Linux SPI]     [Linux Kernel]     [Linux ARM (vger)]     [Linux ARM MSM]     [Linux Omap]     [Linux Arm]     [Linux Tegra]     [Fedora ARM]     [Linux for Samsung SOC]     [eCos]     [Linux Fastboot]     [Gcc Help]     [Git]     [DCCP]     [IETF Announce]     [Security]     [Linux MIPS]     [Yosemite Campsites]

  Powered by Linux