Re: drivers/gpio/gpio-dwapb.c:678:12: warning: stack frame size of 2064 bytes in function 'dwapb_gpio_probe'

From: Andy Shevchenko
Date: Mon May 03 2021 - 04:40:21 EST


On Mon, May 3, 2021 at 1:54 AM kernel test robot <lkp@xxxxxxxxx> wrote:
>
> tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
> head: 27787ba3fa4904422b3928b898d1bd3d74d98bea
> commit: 60593df667e087b009ee0fc20d92e9c4c096a9b5 gpio: dwapb: fix NULL pointer dereference at dwapb_gpio_suspend()
> date: 5 months ago
> config: powerpc64-randconfig-r026-20210430 (attached as .config)
> compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project 8f5a2a5836cc8e4c1def2bdeb022e7b496623439)
> reproduce (this is a W=1 build):
> wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
> chmod +x ~/bin/make.cross
> # install powerpc64 cross compiling tool for clang build
> # apt-get install binutils-powerpc64-linux-gnu
> # https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=60593df667e087b009ee0fc20d92e9c4c096a9b5
> git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
> git fetch --no-tags linus master
> git checkout 60593df667e087b009ee0fc20d92e9c4c096a9b5
> # save the attached .config to linux build tree
> COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 ARCH=powerpc64
>
> If you fix the issue, kindly add following tag as appropriate
> Reported-by: kernel test robot <lkp@xxxxxxxxx>
>
> All warnings (new ones prefixed by >>):
>
> >> drivers/gpio/gpio-dwapb.c:678:12: warning: stack frame size of 2064 bytes in function 'dwapb_gpio_probe' [-Wframe-larger-than=]
> static int dwapb_gpio_probe(struct platform_device *pdev)
> ^
> 1 warning generated.

Another Clang bug?

> vim +/dwapb_gpio_probe +678 drivers/gpio/gpio-dwapb.c
>
> a72b8c4a63e2a3 Hoan Tran 2017-02-21 677
> 7779b34556978f Jamie Iles 2014-02-25 @678 static int dwapb_gpio_probe(struct platform_device *pdev)
> 7779b34556978f Jamie Iles 2014-02-25 679 {
> 3d2613c4289ff2 Weike Chen 2014-09-17 680 unsigned int i;
> 7779b34556978f Jamie Iles 2014-02-25 681 struct dwapb_gpio *gpio;
> 7779b34556978f Jamie Iles 2014-02-25 682 int err;
> 3d2613c4289ff2 Weike Chen 2014-09-17 683 struct device *dev = &pdev->dev;
> 3d2613c4289ff2 Weike Chen 2014-09-17 684 struct dwapb_platform_data *pdata = dev_get_platdata(dev);
> 3d2613c4289ff2 Weike Chen 2014-09-17 685
> da9df93e9e0fd1 Axel Lin 2014-12-28 686 if (!pdata) {
> 4ba8cfa79f44a9 Jiang Qiu 2016-04-28 687 pdata = dwapb_gpio_get_pdata(dev);
> 3d2613c4289ff2 Weike Chen 2014-09-17 688 if (IS_ERR(pdata))
> 3d2613c4289ff2 Weike Chen 2014-09-17 689 return PTR_ERR(pdata);
> 3d2613c4289ff2 Weike Chen 2014-09-17 690 }
> 7779b34556978f Jamie Iles 2014-02-25 691
> da9df93e9e0fd1 Axel Lin 2014-12-28 692 if (!pdata->nports)
> da9df93e9e0fd1 Axel Lin 2014-12-28 693 return -ENODEV;
> 7779b34556978f Jamie Iles 2014-02-25 694
> 3d2613c4289ff2 Weike Chen 2014-09-17 695 gpio = devm_kzalloc(&pdev->dev, sizeof(*gpio), GFP_KERNEL);
> da9df93e9e0fd1 Axel Lin 2014-12-28 696 if (!gpio)
> da9df93e9e0fd1 Axel Lin 2014-12-28 697 return -ENOMEM;
> da9df93e9e0fd1 Axel Lin 2014-12-28 698
> 3d2613c4289ff2 Weike Chen 2014-09-17 699 gpio->dev = &pdev->dev;
> 3d2613c4289ff2 Weike Chen 2014-09-17 700 gpio->nr_ports = pdata->nports;
> 3d2613c4289ff2 Weike Chen 2014-09-17 701
> 4731d80f5ea9b8 Serge Semin 2020-07-30 702 err = dwapb_get_reset(gpio);
> 4731d80f5ea9b8 Serge Semin 2020-07-30 703 if (err)
> 4731d80f5ea9b8 Serge Semin 2020-07-30 704 return err;
> 07901a94f9f9b1 Alan Tull 2017-10-11 705
> 3d2613c4289ff2 Weike Chen 2014-09-17 706 gpio->ports = devm_kcalloc(&pdev->dev, gpio->nr_ports,
> 7779b34556978f Jamie Iles 2014-02-25 707 sizeof(*gpio->ports), GFP_KERNEL);
> da9df93e9e0fd1 Axel Lin 2014-12-28 708 if (!gpio->ports)
> da9df93e9e0fd1 Axel Lin 2014-12-28 709 return -ENOMEM;
> 7779b34556978f Jamie Iles 2014-02-25 710
> 2a7194e9759586 Enrico Weigelt, metux IT consult 2019-03-11 711 gpio->regs = devm_platform_ioremap_resource(pdev, 0);
> da9df93e9e0fd1 Axel Lin 2014-12-28 712 if (IS_ERR(gpio->regs))
> da9df93e9e0fd1 Axel Lin 2014-12-28 713 return PTR_ERR(gpio->regs);
> 7779b34556978f Jamie Iles 2014-02-25 714
> daa3f58d180c07 Serge Semin 2020-07-30 715 err = dwapb_get_clks(gpio);
> daa3f58d180c07 Serge Semin 2020-07-30 716 if (err)
> e6bf37736f6495 Phil Edworthy 2018-03-12 717 return err;
> e6bf37736f6495 Phil Edworthy 2018-03-12 718
> 9826bbe1fef0b5 Andy Shevchenko 2020-04-15 719 gpio->flags = (uintptr_t)device_get_match_data(dev);
> a72b8c4a63e2a3 Hoan Tran 2017-02-21 720
> 3d2613c4289ff2 Weike Chen 2014-09-17 721 for (i = 0; i < gpio->nr_ports; i++) {
> 3d2613c4289ff2 Weike Chen 2014-09-17 722 err = dwapb_gpio_add_port(gpio, &pdata->properties[i], i);
> 7779b34556978f Jamie Iles 2014-02-25 723 if (err)
> 7779b34556978f Jamie Iles 2014-02-25 724 return err;
> 7779b34556978f Jamie Iles 2014-02-25 725 }
> 7779b34556978f Jamie Iles 2014-02-25 726
> 60593df667e087 Luo Jiaxing 2020-11-27 727 platform_set_drvdata(pdev, gpio);
> 60593df667e087 Luo Jiaxing 2020-11-27 728
> 7779b34556978f Jamie Iles 2014-02-25 729 return 0;
> 7779b34556978f Jamie Iles 2014-02-25 730 }
> 7779b34556978f Jamie Iles 2014-02-25 731
>
> :::::: The code at line 678 was first introduced by commit
> :::::: 7779b34556978f6771a78bd87557523623e0405b gpio: add a driver for the Synopsys DesignWare APB GPIO block
>
> :::::: TO: Jamie Iles <jamie@xxxxxxxxxxxxx>
> :::::: CC: Linus Walleij <linus.walleij@xxxxxxxxxx>
>
> ---
> 0-DAY CI Kernel Test Service, Intel Corporation
> https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx



--
With Best Regards,
Andy Shevchenko