diff options
author | Aditya Pakki <pakki001@umn.edu> | 2019-03-12 16:05:52 +0100 |
---|---|---|
committer | Andy Shevchenko <andriy.shevchenko@linux.intel.com> | 2019-03-18 10:43:23 +0100 |
commit | d6cb77228e3ae070061195a6fff6ba7c3c0b8e47 (patch) | |
tree | 27d0cb8245f91afe0c1a6debce5a41ea3e22c0c3 /drivers/pinctrl | |
parent | Linux 5.1-rc1 (diff) | |
download | linux-d6cb77228e3ae070061195a6fff6ba7c3c0b8e47.tar.xz linux-d6cb77228e3ae070061195a6fff6ba7c3c0b8e47.zip |
pinctrl: baytrail: Fix potential NULL pointer dereference
saved-context in byt_gpio_probe is allocated via devm_kcalloc and is
used without checking for NULL in later functions. This patch avoids
such a scenario.
Signed-off-by: Aditya Pakki <pakki001@umn.edu>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Diffstat (limited to 'drivers/pinctrl')
-rw-r--r-- | drivers/pinctrl/intel/pinctrl-baytrail.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/pinctrl/intel/pinctrl-baytrail.c b/drivers/pinctrl/intel/pinctrl-baytrail.c index 241384ead4ed..18d9ad504194 100644 --- a/drivers/pinctrl/intel/pinctrl-baytrail.c +++ b/drivers/pinctrl/intel/pinctrl-baytrail.c @@ -1710,6 +1710,8 @@ static int byt_gpio_probe(struct byt_gpio *vg) #ifdef CONFIG_PM_SLEEP vg->saved_context = devm_kcalloc(&vg->pdev->dev, gc->ngpio, sizeof(*vg->saved_context), GFP_KERNEL); + if (!vg->saved_context) + return -ENOMEM; #endif ret = devm_gpiochip_add_data(&vg->pdev->dev, gc, vg); if (ret) { |