[libcamera-devel,2/6] test: log: log_process: Fix uninitialized variable on process exit failure
diff mbox series

Message ID 20231206210524.20974-3-laurent.pinchart@ideasonboard.com
State Accepted
Commit db3147743368b14b3ed218cb3f6026cb7963d77c
Headers show
Series
  • test: Miscellaneous fixes and improvements for unit tests
Related show

Commit Message

Laurent Pinchart Dec. 6, 2023, 9:05 p.m. UTC
If the process fails to exit before the timeout, the
LogProcessTest::exitStatus_ variable gets used uninitialized. Fix it by
initializating to Process::NotExited.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
 test/log/log_process.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Kieran Bingham Dec. 7, 2023, 4:28 p.m. UTC | #1
Quoting Laurent Pinchart via libcamera-devel (2023-12-06 21:05:20)
> If the process fails to exit before the timeout, the
> LogProcessTest::exitStatus_ variable gets used uninitialized. Fix it by
> initializating to Process::NotExited.


Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>


> 
> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> ---
>  test/log/log_process.cpp | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/test/log/log_process.cpp b/test/log/log_process.cpp
> index 17af7d74a1d5..f7635b70255c 100644
> --- a/test/log/log_process.cpp
> +++ b/test/log/log_process.cpp
> @@ -139,7 +139,7 @@ private:
>         ProcessManager processManager_;
>  
>         Process proc_;
> -       Process::ExitStatus exitStatus_;
> +       Process::ExitStatus exitStatus_ = Process::NotExited;
>         string logPath_;
>         int exitCode_;
>         int num_;
> -- 
> Regards,
> 
> Laurent Pinchart
>
Umang Jain Dec. 8, 2023, 7:11 a.m. UTC | #2
Hi Laurent,

On 12/7/23 2:35 AM, Laurent Pinchart via libcamera-devel wrote:
> If the process fails to exit before the timeout, the
> LogProcessTest::exitStatus_ variable gets used uninitialized. Fix it by
> initializating to Process::NotExited.
>
> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>

> ---
>   test/log/log_process.cpp | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/test/log/log_process.cpp b/test/log/log_process.cpp
> index 17af7d74a1d5..f7635b70255c 100644
> --- a/test/log/log_process.cpp
> +++ b/test/log/log_process.cpp
> @@ -139,7 +139,7 @@ private:
>   	ProcessManager processManager_;
>   
>   	Process proc_;
> -	Process::ExitStatus exitStatus_;
> +	Process::ExitStatus exitStatus_ = Process::NotExited;
>   	string logPath_;
>   	int exitCode_;
>   	int num_;

Patch
diff mbox series

diff --git a/test/log/log_process.cpp b/test/log/log_process.cpp
index 17af7d74a1d5..f7635b70255c 100644
--- a/test/log/log_process.cpp
+++ b/test/log/log_process.cpp
@@ -139,7 +139,7 @@  private:
 	ProcessManager processManager_;
 
 	Process proc_;
-	Process::ExitStatus exitStatus_;
+	Process::ExitStatus exitStatus_ = Process::NotExited;
 	string logPath_;
 	int exitCode_;
 	int num_;