* [PATCH] soc: qcom: initialize local variable
@ 2020-08-19 18:46 trix
2020-08-25 7:27 ` Sibi Sankar
2020-11-24 4:10 ` patchwork-bot+linux-arm-msm
0 siblings, 2 replies; 3+ messages in thread
From: trix @ 2020-08-19 18:46 UTC (permalink / raw)
To: agross, bjorn.andersson, sibis; +Cc: linux-arm-msm, linux-kernel, Tom Rix
From: Tom Rix <trix@redhat.com>
clang static analysis reports this problem
pdr_interface.c:596:6: warning: Branch condition evaluates
to a garbage value
if (!req.service_path[0])
^~~~~~~~~~~~~~~~~~~~
This check that req.service_path was set in an earlier loop.
However req is a stack variable and its initial value
is undefined.
So initialize req to 0.
Fixes: fbe639b44a82 ("soc: qcom: Introduce Protection Domain Restart helpers")
Signed-off-by: Tom Rix <trix@redhat.com>
---
drivers/soc/qcom/pdr_interface.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/soc/qcom/pdr_interface.c b/drivers/soc/qcom/pdr_interface.c
index 088dc99f77f3..f63135c09667 100644
--- a/drivers/soc/qcom/pdr_interface.c
+++ b/drivers/soc/qcom/pdr_interface.c
@@ -569,7 +569,7 @@ EXPORT_SYMBOL(pdr_add_lookup);
int pdr_restart_pd(struct pdr_handle *pdr, struct pdr_service *pds)
{
struct servreg_restart_pd_resp resp;
- struct servreg_restart_pd_req req;
+ struct servreg_restart_pd_req req = { 0 };
struct sockaddr_qrtr addr;
struct pdr_service *tmp;
struct qmi_txn txn;
--
2.18.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] soc: qcom: initialize local variable
2020-08-19 18:46 [PATCH] soc: qcom: initialize local variable trix
@ 2020-08-25 7:27 ` Sibi Sankar
2020-11-24 4:10 ` patchwork-bot+linux-arm-msm
1 sibling, 0 replies; 3+ messages in thread
From: Sibi Sankar @ 2020-08-25 7:27 UTC (permalink / raw)
To: trix
Cc: agross, bjorn.andersson, linux-arm-msm, linux-kernel, linux-kernel-owner
On 2020-08-20 00:16, trix@redhat.com wrote:
> From: Tom Rix <trix@redhat.com>
>
> clang static analysis reports this problem
>
> pdr_interface.c:596:6: warning: Branch condition evaluates
> to a garbage value
> if (!req.service_path[0])
> ^~~~~~~~~~~~~~~~~~~~
>
> This check that req.service_path was set in an earlier loop.
> However req is a stack variable and its initial value
> is undefined.
>
> So initialize req to 0.
>
> Fixes: fbe639b44a82 ("soc: qcom: Introduce Protection Domain Restart
> helpers")
>
Tom,
Thanks for the patch.
Reviewed-by: Sibi Sankar <sibis@codeaurora.org>
> Signed-off-by: Tom Rix <trix@redhat.com>
> ---
> drivers/soc/qcom/pdr_interface.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/soc/qcom/pdr_interface.c
> b/drivers/soc/qcom/pdr_interface.c
> index 088dc99f77f3..f63135c09667 100644
> --- a/drivers/soc/qcom/pdr_interface.c
> +++ b/drivers/soc/qcom/pdr_interface.c
> @@ -569,7 +569,7 @@ EXPORT_SYMBOL(pdr_add_lookup);
> int pdr_restart_pd(struct pdr_handle *pdr, struct pdr_service *pds)
> {
> struct servreg_restart_pd_resp resp;
> - struct servreg_restart_pd_req req;
> + struct servreg_restart_pd_req req = { 0 };
> struct sockaddr_qrtr addr;
> struct pdr_service *tmp;
> struct qmi_txn txn;
--
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] soc: qcom: initialize local variable
2020-08-19 18:46 [PATCH] soc: qcom: initialize local variable trix
2020-08-25 7:27 ` Sibi Sankar
@ 2020-11-24 4:10 ` patchwork-bot+linux-arm-msm
1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+linux-arm-msm @ 2020-11-24 4:10 UTC (permalink / raw)
To: Tom Rix; +Cc: linux-arm-msm
Hello:
This patch was applied to qcom/linux.git (refs/heads/for-next):
On Wed, 19 Aug 2020 11:46:37 -0700 you wrote:
> From: Tom Rix <trix@redhat.com>
>
> clang static analysis reports this problem
>
> pdr_interface.c:596:6: warning: Branch condition evaluates
> to a garbage value
> if (!req.service_path[0])
> ^~~~~~~~~~~~~~~~~~~~
>
> [...]
Here is the summary with links:
- soc: qcom: initialize local variable
https://git.kernel.org/qcom/c/a161ffe4b877
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-11-24 4:10 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-19 18:46 [PATCH] soc: qcom: initialize local variable trix
2020-08-25 7:27 ` Sibi Sankar
2020-11-24 4:10 ` patchwork-bot+linux-arm-msm
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).