* [PATCH] staging: atomisp: off by one in atomisp_acc_load_extensions()
@ 2017-03-14 7:51 Dan Carpenter
0 siblings, 0 replies; only message in thread
From: Dan Carpenter @ 2017-03-14 7:51 UTC (permalink / raw)
To: Mauro Carvalho Chehab, Alan Cox
Cc: Greg Kroah-Hartman, linux-media, devel, kernel-janitors
We should be doing i-- on all error paths but we don't if the loop
finishes successfully. I've re-arranged this so that we don't read
beyond the end of acc_flag_to_pipe[] array.
Fixes: a49d25364dfb ("staging/atomisp: Add support for the Intel IPU v2")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
diff --git a/drivers/staging/media/atomisp/pci/atomisp2/atomisp_acc.c b/drivers/staging/media/atomisp/pci/atomisp2/atomisp_acc.c
index 4c35a785c7d5..212e0a777b4b 100644
--- a/drivers/staging/media/atomisp/pci/atomisp2/atomisp_acc.c
+++ b/drivers/staging/media/atomisp/pci/atomisp2/atomisp_acc.c
@@ -472,10 +472,8 @@ int atomisp_acc_load_extensions(struct atomisp_sub_device *asd)
acc_fw->fw,
acc_flag_to_pipe[i].pipe_id,
acc_fw->type);
- if (ret) {
- i--;
+ if (ret)
goto error;
- }
ext_loaded = true;
}
@@ -499,7 +497,7 @@ int atomisp_acc_load_extensions(struct atomisp_sub_device *asd)
return 0;
error:
- for (; i >= 0; i--) {
+ while (--i >= 0) {
if (acc_fw->flags & acc_flag_to_pipe[i].flag) {
atomisp_css_unload_acc_extension(asd, acc_fw->fw,
acc_flag_to_pipe[i].pipe_id);
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2017-03-14 7:52 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-03-14 7:51 [PATCH] staging: atomisp: off by one in atomisp_acc_load_extensions() Dan Carpenter
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).