lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <5d87c8ba-8464-4d9c-9152-611097b5ae3e@linuxfoundation.org>
Date: Sun, 27 Oct 2024 21:24:55 -0600
From: Shuah Khan <skhan@...uxfoundation.org>
To: MottiKumar Babu <mottikumarbabu@...il.com>
Cc: rostedt@...dmis.org, mhiramat@...nel.org, mark.rutland@....com,
 mathieu.desnoyers@...icios.com, linux-kernel@...r.kernel.org,
 linux-trace-kernel@...r.kernel.org, linux-kernel-mentees@...ts.linux.dev,
 anupnewsmail@...il.com, Shuah Khan <skhan@...uxfoundation.org>
Subject: Re: [PATCH] Removed unnecessary initialization of "ret"

On 10/27/24 15:18, MottiKumar Babu wrote:
> The initialization of ret to 0 was redundant since ret is set to meaningful values later in the function. This change simplifies the code and avoids confusion about its initial state.
> 
> The issue was reported by Coverity Scan.
> 
> Report:
> CID 1633338 Unused value - An assigned value that is never used may represent unnecessary computation, an incorrect algorithm, or possibly the need for cleanup or refactoring.
> In register_ftrace_graph: A value assigned to a variable is never used. (CWE-563)
> 
> 

Check submitting patches document for how to write short log and change logs.

> Signed-off-by: MottiKumar Babu <mottikumarbabu@...il.com>
> ---
>   kernel/trace/fgraph.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/kernel/trace/fgraph.c b/kernel/trace/fgraph.c
> index 69e226a48daa..b13ab2ad0e88 100644
> --- a/kernel/trace/fgraph.c
> +++ b/kernel/trace/fgraph.c
> @@ -1249,7 +1249,7 @@ int register_ftrace_graph(struct fgraph_ops *gops)
>   {
>   	static bool fgraph_initialized;
>   	int command = 0;
> -	int ret = 0;
> +	int ret;
>   	int i = -1;
>   
>   	guard(mutex)(&ftrace_lock);

It makes sense to initialize ret - i think you might see a warning about
ret being not initialized before use. I don't see much value in saving
unnecessary computation.

thanks,
-- Shuah


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ