All of lore.kernel.org
 help / color / mirror / Atom feed
* [linux-next:master 9025/9312] drivers/soc/qcom/pdr_interface.c:316:2: warning: variable 'found' is used uninitialized whenever 'for' loop exits because its condition is false
@ 2020-03-16 22:27 kbuild test robot
  2020-03-16 22:31 ` Nick Desaulniers
  0 siblings, 1 reply; 2+ messages in thread
From: kbuild test robot @ 2020-03-16 22:27 UTC (permalink / raw)
  To: kbuild-all

[-- Attachment #1: Type: text/plain, Size: 5614 bytes --]

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
head:   8548fd2f20ed19b0e8c0585b71fdfde1ae00ae3c
commit: d538b863da31a4070276cebcd490a8bb45c4a45a [9025/9312] Merge remote-tracking branch 'qcom/for-next'
config: arm64-allyesconfig (attached as .config)
compiler: clang version 11.0.0 (git://gitmirror/llvm_project 14a1b80e044aac1947c891525cf30521be0a79b7)
reproduce:
        # FIXME the reproduce steps for clang is not ready yet

If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <lkp@intel.com>

All warnings (new ones prefixed by >>):

>> drivers/soc/qcom/pdr_interface.c:316:2: warning: variable 'found' is used uninitialized whenever 'for' loop exits because its condition is false [-Wsometimes-uninitialized]
           list_for_each_entry(pds, &pdr->lookups, node) {
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/list.h:602:7: note: expanded from macro 'list_for_each_entry'
                &pos->member != (head);                                    \
                ^~~~~~~~~~~~~~~~~~~~~~
   drivers/soc/qcom/pdr_interface.c:325:7: note: uninitialized use occurs here
           if (!found)
                ^~~~~
   drivers/soc/qcom/pdr_interface.c:316:2: note: remove the condition if it is always true
           list_for_each_entry(pds, &pdr->lookups, node) {
           ^
   include/linux/list.h:602:7: note: expanded from macro 'list_for_each_entry'
                &pos->member != (head);                                    \
                ^
   drivers/soc/qcom/pdr_interface.c:309:12: note: initialize the variable 'found' to silence this warning
           bool found;
                     ^
                      = 0
   1 warning generated.

vim +316 drivers/soc/qcom/pdr_interface.c

fbe639b44a82755 Sibi Sankar 2020-03-12  299  
fbe639b44a82755 Sibi Sankar 2020-03-12  300  static void pdr_indication_cb(struct qmi_handle *qmi,
fbe639b44a82755 Sibi Sankar 2020-03-12  301  			      struct sockaddr_qrtr *sq,
fbe639b44a82755 Sibi Sankar 2020-03-12  302  			      struct qmi_txn *txn, const void *data)
fbe639b44a82755 Sibi Sankar 2020-03-12  303  {
fbe639b44a82755 Sibi Sankar 2020-03-12  304  	struct pdr_handle *pdr = container_of(qmi, struct pdr_handle,
fbe639b44a82755 Sibi Sankar 2020-03-12  305  					      notifier_hdl);
fbe639b44a82755 Sibi Sankar 2020-03-12  306  	const struct servreg_state_updated_ind *ind_msg = data;
fbe639b44a82755 Sibi Sankar 2020-03-12  307  	struct pdr_list_node *ind;
fbe639b44a82755 Sibi Sankar 2020-03-12  308  	struct pdr_service *pds;
fbe639b44a82755 Sibi Sankar 2020-03-12  309  	bool found;
fbe639b44a82755 Sibi Sankar 2020-03-12  310  
fbe639b44a82755 Sibi Sankar 2020-03-12  311  	if (!ind_msg || !ind_msg->service_path[0] ||
fbe639b44a82755 Sibi Sankar 2020-03-12  312  	    strlen(ind_msg->service_path) > SERVREG_NAME_LENGTH)
fbe639b44a82755 Sibi Sankar 2020-03-12  313  		return;
fbe639b44a82755 Sibi Sankar 2020-03-12  314  
fbe639b44a82755 Sibi Sankar 2020-03-12  315  	mutex_lock(&pdr->list_lock);
fbe639b44a82755 Sibi Sankar 2020-03-12 @316  	list_for_each_entry(pds, &pdr->lookups, node) {
fbe639b44a82755 Sibi Sankar 2020-03-12  317  		if (strcmp(pds->service_path, ind_msg->service_path))
fbe639b44a82755 Sibi Sankar 2020-03-12  318  			continue;
fbe639b44a82755 Sibi Sankar 2020-03-12  319  
fbe639b44a82755 Sibi Sankar 2020-03-12  320  		found = true;
fbe639b44a82755 Sibi Sankar 2020-03-12  321  		break;
fbe639b44a82755 Sibi Sankar 2020-03-12  322  	}
fbe639b44a82755 Sibi Sankar 2020-03-12  323  	mutex_unlock(&pdr->list_lock);
fbe639b44a82755 Sibi Sankar 2020-03-12  324  
fbe639b44a82755 Sibi Sankar 2020-03-12  325  	if (!found)
fbe639b44a82755 Sibi Sankar 2020-03-12  326  		return;
fbe639b44a82755 Sibi Sankar 2020-03-12  327  
fbe639b44a82755 Sibi Sankar 2020-03-12  328  	pr_info("PDR: Indication received from %s, state: 0x%x, trans-id: %d\n",
fbe639b44a82755 Sibi Sankar 2020-03-12  329  		ind_msg->service_path, ind_msg->curr_state,
fbe639b44a82755 Sibi Sankar 2020-03-12  330  		ind_msg->transaction_id);
fbe639b44a82755 Sibi Sankar 2020-03-12  331  
fbe639b44a82755 Sibi Sankar 2020-03-12  332  	ind = kzalloc(sizeof(*ind), GFP_KERNEL);
fbe639b44a82755 Sibi Sankar 2020-03-12  333  	if (!ind)
fbe639b44a82755 Sibi Sankar 2020-03-12  334  		return;
fbe639b44a82755 Sibi Sankar 2020-03-12  335  
fbe639b44a82755 Sibi Sankar 2020-03-12  336  	ind->transaction_id = ind_msg->transaction_id;
fbe639b44a82755 Sibi Sankar 2020-03-12  337  	ind->curr_state = ind_msg->curr_state;
fbe639b44a82755 Sibi Sankar 2020-03-12  338  	ind->pds = pds;
fbe639b44a82755 Sibi Sankar 2020-03-12  339  
fbe639b44a82755 Sibi Sankar 2020-03-12  340  	mutex_lock(&pdr->list_lock);
fbe639b44a82755 Sibi Sankar 2020-03-12  341  	list_add_tail(&ind->node, &pdr->indack_list);
fbe639b44a82755 Sibi Sankar 2020-03-12  342  	mutex_unlock(&pdr->list_lock);
fbe639b44a82755 Sibi Sankar 2020-03-12  343  
fbe639b44a82755 Sibi Sankar 2020-03-12  344  	queue_work(pdr->indack_wq, &pdr->indack_work);
fbe639b44a82755 Sibi Sankar 2020-03-12  345  }
fbe639b44a82755 Sibi Sankar 2020-03-12  346  

:::::: The code at line 316 was first introduced by commit
:::::: fbe639b44a82755d639df1c5d147c93f02ac5a0f soc: qcom: Introduce Protection Domain Restart helpers

:::::: TO: Sibi Sankar <sibis@codeaurora.org>
:::::: CC: Bjorn Andersson <bjorn.andersson@linaro.org>

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 70507 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [linux-next:master 9025/9312] drivers/soc/qcom/pdr_interface.c:316:2: warning: variable 'found' is used uninitialized whenever 'for' loop exits because its condition is false
  2020-03-16 22:27 [linux-next:master 9025/9312] drivers/soc/qcom/pdr_interface.c:316:2: warning: variable 'found' is used uninitialized whenever 'for' loop exits because its condition is false kbuild test robot
@ 2020-03-16 22:31 ` Nick Desaulniers
  0 siblings, 0 replies; 2+ messages in thread
From: Nick Desaulniers @ 2020-03-16 22:31 UTC (permalink / raw)
  To: kbuild-all

[-- Attachment #1: Type: text/plain, Size: 6590 bytes --]

A patch has just been submitted for this, please ignore the report:
https://github.com/ClangBuiltLinux/linux/issues/933

On Mon, Mar 16, 2020 at 3:28 PM kbuild test robot <lkp@intel.com> wrote:
>
> tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
> head:   8548fd2f20ed19b0e8c0585b71fdfde1ae00ae3c
> commit: d538b863da31a4070276cebcd490a8bb45c4a45a [9025/9312] Merge remote-tracking branch 'qcom/for-next'
> config: arm64-allyesconfig (attached as .config)
> compiler: clang version 11.0.0 (git://gitmirror/llvm_project 14a1b80e044aac1947c891525cf30521be0a79b7)
> reproduce:
>         # FIXME the reproduce steps for clang is not ready yet
>
> If you fix the issue, kindly add following tag
> Reported-by: kbuild test robot <lkp@intel.com>
>
> All warnings (new ones prefixed by >>):
>
> >> drivers/soc/qcom/pdr_interface.c:316:2: warning: variable 'found' is used uninitialized whenever 'for' loop exits because its condition is false [-Wsometimes-uninitialized]
>            list_for_each_entry(pds, &pdr->lookups, node) {
>            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>    include/linux/list.h:602:7: note: expanded from macro 'list_for_each_entry'
>                 &pos->member != (head);                                    \
>                 ^~~~~~~~~~~~~~~~~~~~~~
>    drivers/soc/qcom/pdr_interface.c:325:7: note: uninitialized use occurs here
>            if (!found)
>                 ^~~~~
>    drivers/soc/qcom/pdr_interface.c:316:2: note: remove the condition if it is always true
>            list_for_each_entry(pds, &pdr->lookups, node) {
>            ^
>    include/linux/list.h:602:7: note: expanded from macro 'list_for_each_entry'
>                 &pos->member != (head);                                    \
>                 ^
>    drivers/soc/qcom/pdr_interface.c:309:12: note: initialize the variable 'found' to silence this warning
>            bool found;
>                      ^
>                       = 0
>    1 warning generated.
>
> vim +316 drivers/soc/qcom/pdr_interface.c
>
> fbe639b44a82755 Sibi Sankar 2020-03-12  299
> fbe639b44a82755 Sibi Sankar 2020-03-12  300  static void pdr_indication_cb(struct qmi_handle *qmi,
> fbe639b44a82755 Sibi Sankar 2020-03-12  301                           struct sockaddr_qrtr *sq,
> fbe639b44a82755 Sibi Sankar 2020-03-12  302                           struct qmi_txn *txn, const void *data)
> fbe639b44a82755 Sibi Sankar 2020-03-12  303  {
> fbe639b44a82755 Sibi Sankar 2020-03-12  304     struct pdr_handle *pdr = container_of(qmi, struct pdr_handle,
> fbe639b44a82755 Sibi Sankar 2020-03-12  305                                           notifier_hdl);
> fbe639b44a82755 Sibi Sankar 2020-03-12  306     const struct servreg_state_updated_ind *ind_msg = data;
> fbe639b44a82755 Sibi Sankar 2020-03-12  307     struct pdr_list_node *ind;
> fbe639b44a82755 Sibi Sankar 2020-03-12  308     struct pdr_service *pds;
> fbe639b44a82755 Sibi Sankar 2020-03-12  309     bool found;
> fbe639b44a82755 Sibi Sankar 2020-03-12  310
> fbe639b44a82755 Sibi Sankar 2020-03-12  311     if (!ind_msg || !ind_msg->service_path[0] ||
> fbe639b44a82755 Sibi Sankar 2020-03-12  312         strlen(ind_msg->service_path) > SERVREG_NAME_LENGTH)
> fbe639b44a82755 Sibi Sankar 2020-03-12  313             return;
> fbe639b44a82755 Sibi Sankar 2020-03-12  314
> fbe639b44a82755 Sibi Sankar 2020-03-12  315     mutex_lock(&pdr->list_lock);
> fbe639b44a82755 Sibi Sankar 2020-03-12 @316     list_for_each_entry(pds, &pdr->lookups, node) {
> fbe639b44a82755 Sibi Sankar 2020-03-12  317             if (strcmp(pds->service_path, ind_msg->service_path))
> fbe639b44a82755 Sibi Sankar 2020-03-12  318                     continue;
> fbe639b44a82755 Sibi Sankar 2020-03-12  319
> fbe639b44a82755 Sibi Sankar 2020-03-12  320             found = true;
> fbe639b44a82755 Sibi Sankar 2020-03-12  321             break;
> fbe639b44a82755 Sibi Sankar 2020-03-12  322     }
> fbe639b44a82755 Sibi Sankar 2020-03-12  323     mutex_unlock(&pdr->list_lock);
> fbe639b44a82755 Sibi Sankar 2020-03-12  324
> fbe639b44a82755 Sibi Sankar 2020-03-12  325     if (!found)
> fbe639b44a82755 Sibi Sankar 2020-03-12  326             return;
> fbe639b44a82755 Sibi Sankar 2020-03-12  327
> fbe639b44a82755 Sibi Sankar 2020-03-12  328     pr_info("PDR: Indication received from %s, state: 0x%x, trans-id: %d\n",
> fbe639b44a82755 Sibi Sankar 2020-03-12  329             ind_msg->service_path, ind_msg->curr_state,
> fbe639b44a82755 Sibi Sankar 2020-03-12  330             ind_msg->transaction_id);
> fbe639b44a82755 Sibi Sankar 2020-03-12  331
> fbe639b44a82755 Sibi Sankar 2020-03-12  332     ind = kzalloc(sizeof(*ind), GFP_KERNEL);
> fbe639b44a82755 Sibi Sankar 2020-03-12  333     if (!ind)
> fbe639b44a82755 Sibi Sankar 2020-03-12  334             return;
> fbe639b44a82755 Sibi Sankar 2020-03-12  335
> fbe639b44a82755 Sibi Sankar 2020-03-12  336     ind->transaction_id = ind_msg->transaction_id;
> fbe639b44a82755 Sibi Sankar 2020-03-12  337     ind->curr_state = ind_msg->curr_state;
> fbe639b44a82755 Sibi Sankar 2020-03-12  338     ind->pds = pds;
> fbe639b44a82755 Sibi Sankar 2020-03-12  339
> fbe639b44a82755 Sibi Sankar 2020-03-12  340     mutex_lock(&pdr->list_lock);
> fbe639b44a82755 Sibi Sankar 2020-03-12  341     list_add_tail(&ind->node, &pdr->indack_list);
> fbe639b44a82755 Sibi Sankar 2020-03-12  342     mutex_unlock(&pdr->list_lock);
> fbe639b44a82755 Sibi Sankar 2020-03-12  343
> fbe639b44a82755 Sibi Sankar 2020-03-12  344     queue_work(pdr->indack_wq, &pdr->indack_work);
> fbe639b44a82755 Sibi Sankar 2020-03-12  345  }
> fbe639b44a82755 Sibi Sankar 2020-03-12  346
>
> :::::: The code at line 316 was first introduced by commit
> :::::: fbe639b44a82755d639df1c5d147c93f02ac5a0f soc: qcom: Introduce Protection Domain Restart helpers
>
> :::::: TO: Sibi Sankar <sibis@codeaurora.org>
> :::::: CC: Bjorn Andersson <bjorn.andersson@linaro.org>
>
> ---
> 0-DAY CI Kernel Test Service, Intel Corporation
> https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
>
> --
> 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-linux+unsubscribe(a)googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/clang-built-linux/202003170630.NGJUYTfo%25lkp%40intel.com.



-- 
Thanks,
~Nick Desaulniers

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-03-16 22:31 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-16 22:27 [linux-next:master 9025/9312] drivers/soc/qcom/pdr_interface.c:316:2: warning: variable 'found' is used uninitialized whenever 'for' loop exits because its condition is false kbuild test robot
2020-03-16 22:31 ` Nick Desaulniers

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.