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

2 views
Skip to first unread message

kernel test robot

unread,
May 2, 2021, 6:54:49 PM5/2/21
to Luo Jiaxing, kbuil...@lists.01.org, clang-bu...@googlegroups.com, linux-...@vger.kernel.org, Bartosz Golaszewski, Andy Shevchenko
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 <l...@intel.com>

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.


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 <ja...@jamieiles.com>
:::::: CC: Linus Walleij <linus....@linaro.org>

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuil...@lists.01.org
.config.gz

Andy Shevchenko

unread,
May 3, 2021, 4:40:16 AM5/3/21
to kernel test robot, Nick Desaulniers, Luo Jiaxing, kbuil...@lists.01.org, clang-built-linux, Linux Kernel Mailing List, Bartosz Golaszewski
Another Clang bug?
--
With Best Regards,
Andy Shevchenko

Nick Desaulniers

unread,
May 3, 2021, 4:49:37 PM5/3/21
to Andy Shevchenko, kernel test robot, Luo Jiaxing, kbuil...@lists.01.org, clang-built-linux, Linux Kernel Mailing List, Bartosz Golaszewski
We have a KI with ASAN's requirements on additional stack usage for
shadow stacks not being considered when making decisions whether or
not to inline. Looks like KASAN isn't enabled by this randconfig;
UBSAN is. I don't know if UBSAN has similar additional stack usage to
KASAN.

I can reproduce this warning on mainline with:
$ wget https://groups.google.com/group/clang-built-linux/attach/983d2ad77c1d/.config.gz\?part\=0.1
-O - | gunzip > .config
$ ARCH=powerpc CROSS_COMPILE=powerpc64le-linux-gnu- make CC=clang -j72
drivers/gpio/gpio-dwapb.o

If I enable CONFIG_DEBUG_INFO, then rebuild, I have a utility for
helping track these down from parsing the DWARF debug info.
Unfortunately, it depends on pyelftools which doesn't know any ppc64
relocations; let me see if I can implement that real quick, which
should help debug this futher.
> --
> You received this message because you are subscribed to the Google Groups "Clang Built Linux" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to clang-built-li...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/clang-built-linux/CAHp75Vd9kXo7%3Dg35x_AosWBHJH0KBVeX4qgkpbTz31m3w3s3gA%40mail.gmail.com.



--
Thanks,
~Nick Desaulniers

Nick Desaulniers

unread,
May 3, 2021, 7:39:26 PM5/3/21
to Andy Shevchenko, kernel test robot, Luo Jiaxing, kbuil...@lists.01.org, clang-built-linux, Linux Kernel Mailing List, Bartosz Golaszewski
> should help debug this further.

https://github.com/eliben/pyelftools/pull/360
--
Thanks,
~Nick Desaulniers
Reply all
Reply to author
Forward
0 new messages