Re: [PATCH v2 2/2] kernel.h: Disable -Wreturn-stack-address for _THIS_IP_

From: Nathan Chancellor
Date: Tue Jul 31 2018 - 13:03:05 EST


On Tue, Jul 31, 2018 at 09:48:57AM -0700, Nick Desaulniers wrote:
> Does anyone understand this error? The code looks just fine to me,
> and the source file doesn't conflict with any of the macros I've added
> (certainly not in any way that could cause an indentation error as
> reported here).

Unfortunately, I've been trying to work through it this morning and I
can't understand it either. lock_map_acquire_read's defintion does
include _THIS_IP_ and adding curly braces to the if statement fixes it
but that doesn't explain why it's happening.

Maybe this is a GCC bug/issue?

Cheers,
Nathan

> On Tue, Jul 31, 2018 at 3:27 AM kbuild test robot <lkp@xxxxxxxxx> wrote:
> >
> > Hi Nick,
> >
> > Thank you for the patch! Perhaps something to improve:
> >
> > [auto build test WARNING on linus/master]
> > [also build test WARNING on v4.18-rc7 next-20180727]
> > [if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
> >
> > url: https://github.com/0day-ci/linux/commits/Nick-Desaulniers/compiler-clang-h-Add-CLANG_VERSION-and-__diag-macros/20180731-161932
> > config: x86_64-fedora-25 (attached as .config)
> > compiler: gcc-7 (Debian 7.3.0-16) 7.3.0
> > reproduce:
> > # save the attached .config to linux build tree
> > make ARCH=x86_64
> >
> > All warnings (new ones prefixed by >>):
> >
> > drivers/net//wireless/intel/iwlwifi/iwl-trans.c: In function 'iwl_trans_send_cmd':
> > >> drivers/net//wireless/intel/iwlwifi/iwl-trans.c:137:2: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
> > if (!(cmd->flags & CMD_ASYNC))
> > ^~
> > drivers/net//wireless/intel/iwlwifi/iwl-trans.c:138:1: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
> > lock_map_acquire_read(&trans->sync_cmd_lockdep_map);
> > ^ ~
> >
> > vim +/if +137 drivers/net//wireless/intel/iwlwifi/iwl-trans.c
> >
> > 92fe8343 Emmanuel Grumbach 2015-12-01 116
> > 92fe8343 Emmanuel Grumbach 2015-12-01 117 int iwl_trans_send_cmd(struct iwl_trans *trans, struct iwl_host_cmd *cmd)
> > 92fe8343 Emmanuel Grumbach 2015-12-01 118 {
> > 92fe8343 Emmanuel Grumbach 2015-12-01 119 int ret;
> > 92fe8343 Emmanuel Grumbach 2015-12-01 120
> > 92fe8343 Emmanuel Grumbach 2015-12-01 121 if (unlikely(!(cmd->flags & CMD_SEND_IN_RFKILL) &&
> > 326477e4 Johannes Berg 2017-04-25 122 test_bit(STATUS_RFKILL_OPMODE, &trans->status)))
> > 92fe8343 Emmanuel Grumbach 2015-12-01 123 return -ERFKILL;
> > 92fe8343 Emmanuel Grumbach 2015-12-01 124
> > 92fe8343 Emmanuel Grumbach 2015-12-01 125 if (unlikely(test_bit(STATUS_FW_ERROR, &trans->status)))
> > 92fe8343 Emmanuel Grumbach 2015-12-01 126 return -EIO;
> > 92fe8343 Emmanuel Grumbach 2015-12-01 127
> > 92fe8343 Emmanuel Grumbach 2015-12-01 128 if (unlikely(trans->state != IWL_TRANS_FW_ALIVE)) {
> > 92fe8343 Emmanuel Grumbach 2015-12-01 129 IWL_ERR(trans, "%s bad state = %d\n", __func__, trans->state);
> > 92fe8343 Emmanuel Grumbach 2015-12-01 130 return -EIO;
> > 92fe8343 Emmanuel Grumbach 2015-12-01 131 }
> > 92fe8343 Emmanuel Grumbach 2015-12-01 132
> > 92fe8343 Emmanuel Grumbach 2015-12-01 133 if (WARN_ON((cmd->flags & CMD_WANT_ASYNC_CALLBACK) &&
> > 92fe8343 Emmanuel Grumbach 2015-12-01 134 !(cmd->flags & CMD_ASYNC)))
> > 92fe8343 Emmanuel Grumbach 2015-12-01 135 return -EINVAL;
> > 92fe8343 Emmanuel Grumbach 2015-12-01 136
> > 92fe8343 Emmanuel Grumbach 2015-12-01 @137 if (!(cmd->flags & CMD_ASYNC))
> > 92fe8343 Emmanuel Grumbach 2015-12-01 138 lock_map_acquire_read(&trans->sync_cmd_lockdep_map);
> > 92fe8343 Emmanuel Grumbach 2015-12-01 139
> > 5b88792c Sara Sharon 2016-08-15 140 if (trans->wide_cmd_header && !iwl_cmd_groupid(cmd->id))
> > 5b88792c Sara Sharon 2016-08-15 141 cmd->id = DEF_ID(cmd->id);
> > 5b88792c Sara Sharon 2016-08-15 142
> > 92fe8343 Emmanuel Grumbach 2015-12-01 143 ret = trans->ops->send_cmd(trans, cmd);
> > 92fe8343 Emmanuel Grumbach 2015-12-01 144
> > 92fe8343 Emmanuel Grumbach 2015-12-01 145 if (!(cmd->flags & CMD_ASYNC))
> > 92fe8343 Emmanuel Grumbach 2015-12-01 146 lock_map_release(&trans->sync_cmd_lockdep_map);
> > 92fe8343 Emmanuel Grumbach 2015-12-01 147
> > 0ec971fd Johannes Berg 2017-04-10 148 if (WARN_ON((cmd->flags & CMD_WANT_SKB) && !ret && !cmd->resp_pkt))
> > 0ec971fd Johannes Berg 2017-04-10 149 return -EIO;
> > 0ec971fd Johannes Berg 2017-04-10 150
> > 92fe8343 Emmanuel Grumbach 2015-12-01 151 return ret;
> > 92fe8343 Emmanuel Grumbach 2015-12-01 152 }
> > 92fe8343 Emmanuel Grumbach 2015-12-01 153 IWL_EXPORT_SYMBOL(iwl_trans_send_cmd);
> > 39bdb17e Sharon Dvir 2015-10-15 154
> >
> > :::::: The code at line 137 was first introduced by commit
> > :::::: 92fe83430b899b786c837e5b716a328220d47ae5 iwlwifi: uninline iwl_trans_send_cmd
> >
> > :::::: TO: Emmanuel Grumbach <emmanuel.grumbach@xxxxxxxxx>
> > :::::: CC: Emmanuel Grumbach <emmanuel.grumbach@xxxxxxxxx>
> >
> > ---
> > 0-DAY kernel test infrastructure Open Source Technology Center
> > https://lists.01.org/pipermail/kbuild-all Intel Corporation
>
>
>
> --
> Thanks,
> ~Nick Desaulniers