* [PATCH] dmaengine: qcom: fix gpi undefined behavior
@ 2021-01-03 13:57 Arnd Bergmann
2021-01-04 12:38 ` Vinod Koul
2021-03-01 19:59 ` patchwork-bot+linux-arm-msm
0 siblings, 2 replies; 3+ messages in thread
From: Arnd Bergmann @ 2021-01-03 13:57 UTC (permalink / raw)
To: Andy Gross, Bjorn Andersson, Vinod Koul
Cc: Arnd Bergmann, Dan Williams, linux-arm-msm, dmaengine, linux-kernel
From: Arnd Bergmann <arnd@arndb.de>
gcc points out an incorrect error handling loop:
drivers/dma/qcom/gpi.c: In function 'gpi_ch_init':
drivers/dma/qcom/gpi.c:1254:15: error: iteration 2 invokes undefined behavior [-Werror=aggressive-loop-optimizations]
1254 | struct gpii *gpii = gchan->gpii;
| ^~~~
drivers/dma/qcom/gpi.c:1951:2: note: within this loop
1951 | for (i = i - 1; i >= 0; i++) {
| ^~~
Change the loop to correctly walk backwards through the
initialized fields rather than off into the woods.
Fixes: 5d0c3533a19f ("dmaengine: qcom: Add GPI dma driver")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
drivers/dma/qcom/gpi.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/dma/qcom/gpi.c b/drivers/dma/qcom/gpi.c
index 8d39d3e24686..9c211104ddbf 100644
--- a/drivers/dma/qcom/gpi.c
+++ b/drivers/dma/qcom/gpi.c
@@ -1948,7 +1948,7 @@ static int gpi_ch_init(struct gchan *gchan)
return ret;
error_start_chan:
- for (i = i - 1; i >= 0; i++) {
+ for (i = i - 1; i >= 0; i--) {
gpi_stop_chan(&gpii->gchan[i]);
gpi_send_cmd(gpii, gchan, GPI_CH_CMD_RESET);
}
--
2.29.2
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] dmaengine: qcom: fix gpi undefined behavior
2021-01-03 13:57 [PATCH] dmaengine: qcom: fix gpi undefined behavior Arnd Bergmann
@ 2021-01-04 12:38 ` Vinod Koul
2021-03-01 19:59 ` patchwork-bot+linux-arm-msm
1 sibling, 0 replies; 3+ messages in thread
From: Vinod Koul @ 2021-01-04 12:38 UTC (permalink / raw)
To: Arnd Bergmann
Cc: Andy Gross, Bjorn Andersson, Arnd Bergmann, Dan Williams,
linux-arm-msm, dmaengine, linux-kernel
On 03-01-21, 14:57, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@arndb.de>
>
> gcc points out an incorrect error handling loop:
>
> drivers/dma/qcom/gpi.c: In function 'gpi_ch_init':
> drivers/dma/qcom/gpi.c:1254:15: error: iteration 2 invokes undefined behavior [-Werror=aggressive-loop-optimizations]
> 1254 | struct gpii *gpii = gchan->gpii;
> | ^~~~
> drivers/dma/qcom/gpi.c:1951:2: note: within this loop
> 1951 | for (i = i - 1; i >= 0; i++) {
> | ^~~
>
> Change the loop to correctly walk backwards through the
> initialized fields rather than off into the woods.
Applied, thanks
--
~Vinod
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] dmaengine: qcom: fix gpi undefined behavior
2021-01-03 13:57 [PATCH] dmaengine: qcom: fix gpi undefined behavior Arnd Bergmann
2021-01-04 12:38 ` Vinod Koul
@ 2021-03-01 19:59 ` patchwork-bot+linux-arm-msm
1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+linux-arm-msm @ 2021-03-01 19:59 UTC (permalink / raw)
To: Arnd Bergmann; +Cc: linux-arm-msm
Hello:
This patch was applied to qcom/linux.git (refs/heads/for-next):
On Sun, 3 Jan 2021 14:57:29 +0100 you wrote:
> From: Arnd Bergmann <arnd@arndb.de>
>
> gcc points out an incorrect error handling loop:
>
> drivers/dma/qcom/gpi.c: In function 'gpi_ch_init':
> drivers/dma/qcom/gpi.c:1254:15: error: iteration 2 invokes undefined behavior [-Werror=aggressive-loop-optimizations]
> 1254 | struct gpii *gpii = gchan->gpii;
> | ^~~~
> drivers/dma/qcom/gpi.c:1951:2: note: within this loop
> 1951 | for (i = i - 1; i >= 0; i++) {
> | ^~~
>
> [...]
Here is the summary with links:
- dmaengine: qcom: fix gpi undefined behavior
https://git.kernel.org/qcom/c/0bd1bf86ab79
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:[~2021-03-01 20:58 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-03 13:57 [PATCH] dmaengine: qcom: fix gpi undefined behavior Arnd Bergmann
2021-01-04 12:38 ` Vinod Koul
2021-03-01 19:59 ` patchwork-bot+linux-arm-msm
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.