CC: [email protected]
CC: [email protected]
BCC: [email protected]
CC: Linux Memory Management List <[email protected]>
TO: Fabien Dessenne <[email protected]>
CC: Linus Walleij <[email protected]>

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git 
master
head:   b1d84fc09a961e0a8be3d3dc6ca1b7cddc3ced87
commit: 3389b09878dddd58ef52bd0bf43cc42ea5a9ea2a [8143/14159] pinctrl: stm32: 
prevent the use of the secure protected pins
:::::: branch date: 7 hours ago
:::::: commit date: 3 weeks ago
config: arm-randconfig-c002-20220524 
(https://download.01.org/0day-ci/archive/20220526/[email protected]/config)
compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project 
3d546191ad9d7d2ad2c7928204b9de51deafa675)
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 arm cross compiling tool for clang build
        # apt-get install binutils-arm-linux-gnueabi
        # 
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/?id=3389b09878dddd58ef52bd0bf43cc42ea5a9ea2a
        git remote add linux-next 
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
        git fetch --no-tags linux-next master
        git checkout 3389b09878dddd58ef52bd0bf43cc42ea5a9ea2a
        # save the config file
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=arm 
clang-analyzer 

If you fix the issue, kindly add following tag where applicable
Reported-by: kernel test robot <[email protected]>


clang-analyzer warnings: (new ones prefixed by >>)
           ^
   include/linux/printk.h:640:3: note: expanded from macro 'printk_ratelimited'
                   printk(fmt, ##__VA_ARGS__);                             \
                   ^
   include/linux/printk.h:446:26: note: expanded from macro 'printk'
   #define printk(fmt, ...) printk_index_wrap(_printk, fmt, ##__VA_ARGS__)
                            ^
   include/linux/printk.h:417:3: note: expanded from macro 'printk_index_wrap'
                   __printk_index_emit(_fmt, NULL, NULL);                  \
                   ^
   include/linux/printk.h:370:3: note: expanded from macro '__printk_index_emit'
                   if (__builtin_constant_p(_fmt) && 
__builtin_constant_p(_level)) { \
                   ^
   include/linux/hid.h:1055:3: note: '?' condition is true
                   pr_warn_ratelimited("%s: Invalid code %d type %d\n",
                   ^
   include/linux/printk.h:656:2: note: expanded from macro 'pr_warn_ratelimited'
           printk_ratelimited(KERN_WARNING pr_fmt(fmt), ##__VA_ARGS__)
           ^
   include/linux/printk.h:640:3: note: expanded from macro 'printk_ratelimited'
                   printk(fmt, ##__VA_ARGS__);                             \
                   ^
   include/linux/printk.h:446:26: note: expanded from macro 'printk'
   #define printk(fmt, ...) printk_index_wrap(_printk, fmt, ##__VA_ARGS__)
                            ^
   include/linux/printk.h:417:3: note: expanded from macro 'printk_index_wrap'
                   __printk_index_emit(_fmt, NULL, NULL);                  \
                   ^
   include/linux/printk.h:379:12: note: expanded from macro 
'__printk_index_emit'
                                   .fmt = __builtin_constant_p(_fmt) ? (_fmt) : 
NULL, \
                                          ^
   include/linux/hid.h:1055:3: note: '?' condition is true
                   pr_warn_ratelimited("%s: Invalid code %d type %d\n",
                   ^
   include/linux/printk.h:656:2: note: expanded from macro 'pr_warn_ratelimited'
           printk_ratelimited(KERN_WARNING pr_fmt(fmt), ##__VA_ARGS__)
           ^
   include/linux/printk.h:640:3: note: expanded from macro 'printk_ratelimited'
                   printk(fmt, ##__VA_ARGS__);                             \
                   ^
   include/linux/printk.h:446:26: note: expanded from macro 'printk'
   #define printk(fmt, ...) printk_index_wrap(_printk, fmt, ##__VA_ARGS__)
                            ^
   include/linux/printk.h:417:3: note: expanded from macro 'printk_index_wrap'
                   __printk_index_emit(_fmt, NULL, NULL);                  \
                   ^
   include/linux/printk.h:383:14: note: expanded from macro 
'__printk_index_emit'
                                   .level = __builtin_constant_p(_level) ? 
(_level) : NULL, \
                                            ^
   include/linux/hid.h:1055:3: note: Loop condition is false.  Exiting loop
                   pr_warn_ratelimited("%s: Invalid code %d type %d\n",
                   ^
   include/linux/printk.h:656:2: note: expanded from macro 'pr_warn_ratelimited'
           printk_ratelimited(KERN_WARNING pr_fmt(fmt), ##__VA_ARGS__)
           ^
   include/linux/printk.h:640:3: note: expanded from macro 'printk_ratelimited'
                   printk(fmt, ##__VA_ARGS__);                             \
                   ^
   include/linux/printk.h:446:26: note: expanded from macro 'printk'
   #define printk(fmt, ...) printk_index_wrap(_printk, fmt, ##__VA_ARGS__)
                            ^
   include/linux/printk.h:417:3: note: expanded from macro 'printk_index_wrap'
                   __printk_index_emit(_fmt, NULL, NULL);                  \
                   ^
   include/linux/printk.h:369:2: note: expanded from macro '__printk_index_emit'
           do {                                                            \
           ^
   include/linux/hid.h:1056:9: note: Access to field 'name' results in a 
dereference of a null pointer (loaded from variable 'input')
                                       input->name, c, type);
                                       ^
   include/linux/printk.h:656:49: note: expanded from macro 
'pr_warn_ratelimited'
           printk_ratelimited(KERN_WARNING pr_fmt(fmt), ##__VA_ARGS__)
                                                          ^~~~~~~~~~~
   include/linux/printk.h:640:17: note: expanded from macro 'printk_ratelimited'
                   printk(fmt, ##__VA_ARGS__);                             \
                                 ^~~~~~~~~~~
   include/linux/printk.h:446:60: note: expanded from macro 'printk'
   #define printk(fmt, ...) printk_index_wrap(_printk, fmt, ##__VA_ARGS__)
                                                              ^~~~~~~~~~~
   include/linux/printk.h:418:19: note: expanded from macro 'printk_index_wrap'
                   _p_func(_fmt, ##__VA_ARGS__);                           \
                                   ^~~~~~~~~~~
   Suppressed 29 warnings (29 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use 
-system-headers to display errors from system headers as well.
   30 warnings generated.
   drivers/pinctrl/meson/pinctrl-meson8-pmx.c:60:25: warning: Value stored to 
'func' during its initialization is never read 
[clang-analyzer-deadcode.DeadStores]
           struct meson_pmx_func *func = &pc->data->funcs[func_num];
                                  ^~~~   ~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/pinctrl/meson/pinctrl-meson8-pmx.c:60:25: note: Value stored to 
'func' during its initialization is never read
           struct meson_pmx_func *func = &pc->data->funcs[func_num];
                                  ^~~~   ~~~~~~~~~~~~~~~~~~~~~~~~~~
   Suppressed 29 warnings (29 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use 
-system-headers to display errors from system headers as well.
   29 warnings generated.
   Suppressed 29 warnings (29 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use 
-system-headers to display errors from system headers as well.
   29 warnings generated.
   Suppressed 29 warnings (29 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use 
-system-headers to display errors from system headers as well.
   32 warnings generated.
>> drivers/pinctrl/stm32/pinctrl-stm32.c:294:24: warning: Value stored to 
>> 'pctl' during its initialization is never read 
>> [clang-analyzer-deadcode.DeadStores]
           struct stm32_pinctrl *pctl = dev_get_drvdata(bank->gpio_chip.parent);
                                 ^~~~   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/pinctrl/stm32/pinctrl-stm32.c:294:24: note: Value stored to 'pctl' 
during its initialization is never read
           struct stm32_pinctrl *pctl = dev_get_drvdata(bank->gpio_chip.parent);
                                 ^~~~   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/pinctrl/stm32/pinctrl-stm32.c:1422:21: warning: Passed-by-value 
struct argument contains uninitialized data (e.g., field: 'id_size') 
[clang-analyzer-core.CallAndMessage]
                   pctl->irqmux[i] = devm_regmap_field_alloc(dev, rm, mux);
                                     ^
   drivers/pinctrl/stm32/pinctrl-stm32.c:1494:6: note: Assuming 'np' is non-null
           if (!np)
               ^~~
   drivers/pinctrl/stm32/pinctrl-stm32.c:1494:2: note: Taking false branch
           if (!np)
           ^
   drivers/pinctrl/stm32/pinctrl-stm32.c:1498:6: note: Assuming 'match' is 
non-null
           if (!match || !match->data)
               ^~~~~~
   drivers/pinctrl/stm32/pinctrl-stm32.c:1498:6: note: Left side of '||' is 
false
   drivers/pinctrl/stm32/pinctrl-stm32.c:1498:16: note: Assuming field 'data' 
is non-null
           if (!match || !match->data)
                         ^~~~~~~~~~~~
   drivers/pinctrl/stm32/pinctrl-stm32.c:1498:2: note: Taking false branch
           if (!match || !match->data)
           ^
   drivers/pinctrl/stm32/pinctrl-stm32.c:1501:6: note: Assuming the condition 
is false
           if (!of_find_property(np, "pins-are-numbered", NULL)) {
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/pinctrl/stm32/pinctrl-stm32.c:1501:2: note: Taking false branch
           if (!of_find_property(np, "pins-are-numbered", NULL)) {
           ^
   drivers/pinctrl/stm32/pinctrl-stm32.c:1507:6: note: Assuming 'pctl' is 
non-null
           if (!pctl)
               ^~~~~
   drivers/pinctrl/stm32/pinctrl-stm32.c:1507:2: note: Taking false branch
           if (!pctl)
           ^
   drivers/pinctrl/stm32/pinctrl-stm32.c:1514:2: note: Taking false branch
           if (IS_ERR(pctl->domain))
           ^
   drivers/pinctrl/stm32/pinctrl-stm32.c:1519:6: note: 'hwlock_id' is >= 0
           if (hwlock_id < 0) {
               ^~~~~~~~~
   drivers/pinctrl/stm32/pinctrl-stm32.c:1519:2: note: Taking false branch
           if (hwlock_id < 0) {
           ^
   drivers/pinctrl/stm32/pinctrl-stm32.c:1526:2: note: Loop condition is false. 
 Exiting loop
           spin_lock_init(&pctl->irqmux_lock);
           ^
   include/linux/spinlock.h:339:34: note: expanded from macro 'spin_lock_init'
   # define spin_lock_init(_lock)                  \
                                                   ^
   drivers/pinctrl/stm32/pinctrl-stm32.c:1532:2: note: Taking false branch
           if (!of_property_read_u32(np, "st,package", &pctl->pkg))
           ^
   drivers/pinctrl/stm32/pinctrl-stm32.c:1537:6: note: Assuming field 'pins' is 
non-null
           if (!pctl->pins)
               ^~~~~~~~~~~
   drivers/pinctrl/stm32/pinctrl-stm32.c:1537:2: note: Taking false branch
           if (!pctl->pins)
           ^
   drivers/pinctrl/stm32/pinctrl-stm32.c:1541:6: note: 'ret' is 0
           if (ret)
               ^~~
   drivers/pinctrl/stm32/pinctrl-stm32.c:1541:2: note: Taking false branch
           if (ret)
           ^
   drivers/pinctrl/stm32/pinctrl-stm32.c:1545:6: note: Assuming 'ret' is 0
           if (ret) {
               ^~~
   drivers/pinctrl/stm32/pinctrl-stm32.c:1545:2: note: Taking false branch
           if (ret) {
           ^
   drivers/pinctrl/stm32/pinctrl-stm32.c:1550:6: note: Assuming field 'domain' 
is non-null
           if (pctl->domain) {
               ^~~~~~~~~~~~
   drivers/pinctrl/stm32/pinctrl-stm32.c:1550:2: note: Taking true branch
           if (pctl->domain) {
           ^
   drivers/pinctrl/stm32/pinctrl-stm32.c:1551:9: note: Calling 
'stm32_pctrl_dt_setup_irq'
                   ret = stm32_pctrl_dt_setup_irq(pdev, pctl);
                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/pinctrl/stm32/pinctrl-stm32.c:1397:2: note: Taking false branch
           if (IS_ERR(pctl->regmap))
           ^
   drivers/pinctrl/stm32/pinctrl-stm32.c:1403:6: note: Assuming 'ret' is 0
           if (ret)
               ^~~
   drivers/pinctrl/stm32/pinctrl-stm32.c:1403:2: note: Taking false branch
           if (ret)
           ^
   drivers/pinctrl/stm32/pinctrl-stm32.c:1407:6: note: Assuming 'ret' is 0
           if (ret)
               ^~~
   drivers/pinctrl/stm32/pinctrl-stm32.c:1407:2: note: Taking false branch
           if (ret)
           ^
   drivers/pinctrl/stm32/pinctrl-stm32.c:1412:2: note: Loop condition is true.  
Entering loop body
           for (i = 0; i < STM32_GPIO_PINS_PER_BANK; i++) {
           ^
   drivers/pinctrl/stm32/pinctrl-stm32.c:1413:3: note: 'mux' initialized here

vim +/pctl +294 drivers/pinctrl/stm32/pinctrl-stm32.c

acaa037970f610 Alexandre TORGUE 2017-05-29  288  
3389b09878dddd Fabien Dessenne  2022-05-02  289  static int 
stm32_gpio_init_valid_mask(struct gpio_chip *chip,
3389b09878dddd Fabien Dessenne  2022-05-02  290                                 
      unsigned long *valid_mask,
3389b09878dddd Fabien Dessenne  2022-05-02  291                                 
      unsigned int ngpios)
3389b09878dddd Fabien Dessenne  2022-05-02  292  {
3389b09878dddd Fabien Dessenne  2022-05-02  293         struct stm32_gpio_bank 
*bank = gpiochip_get_data(chip);
3389b09878dddd Fabien Dessenne  2022-05-02 @294         struct stm32_pinctrl 
*pctl = dev_get_drvdata(bank->gpio_chip.parent);
3389b09878dddd Fabien Dessenne  2022-05-02  295         unsigned int i;
3389b09878dddd Fabien Dessenne  2022-05-02  296         u32 sec;
3389b09878dddd Fabien Dessenne  2022-05-02  297  
3389b09878dddd Fabien Dessenne  2022-05-02  298         /* All gpio are valid 
per default */
3389b09878dddd Fabien Dessenne  2022-05-02  299         bitmap_fill(valid_mask, 
ngpios);
3389b09878dddd Fabien Dessenne  2022-05-02  300  
3389b09878dddd Fabien Dessenne  2022-05-02  301         if 
(bank->secure_control) {
3389b09878dddd Fabien Dessenne  2022-05-02  302                 /* Tag secured 
pins as invalid */
3389b09878dddd Fabien Dessenne  2022-05-02  303                 sec = 
readl_relaxed(bank->base + STM32_GPIO_SECCFGR);
3389b09878dddd Fabien Dessenne  2022-05-02  304  
3389b09878dddd Fabien Dessenne  2022-05-02  305                 for (i = 0; i < 
ngpios; i++) {
3389b09878dddd Fabien Dessenne  2022-05-02  306                         if (sec 
& BIT(i)) {
3389b09878dddd Fabien Dessenne  2022-05-02  307                                 
clear_bit(i, valid_mask);
3389b09878dddd Fabien Dessenne  2022-05-02  308                                 
dev_dbg(pctl->dev, "No access to gpio %d - %d\n", bank->bank_nr, i);
3389b09878dddd Fabien Dessenne  2022-05-02  309                         }
3389b09878dddd Fabien Dessenne  2022-05-02  310                 }
3389b09878dddd Fabien Dessenne  2022-05-02  311         }
3389b09878dddd Fabien Dessenne  2022-05-02  312  
3389b09878dddd Fabien Dessenne  2022-05-02  313         return 0;
3389b09878dddd Fabien Dessenne  2022-05-02  314  }
3389b09878dddd Fabien Dessenne  2022-05-02  315  

-- 
0-DAY CI Kernel Test Service
https://01.org/lkp
_______________________________________________
kbuild mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to