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-next>] [day] [month] [year] [list]
Date:	Fri, 11 May 2012 23:08:02 -0400
From:	Steven Rostedt <rostedt@...dmis.org>
To:	Raphael Santana carvalho <utroz@...coders.com>
Cc:	fweisbec@...il.com, mingo@...hat.com, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 1/1] kernel/trace: gcc warning: uninitialized variable.

On Fri, 2012-05-11 at 23:26 -0300, Raphael Santana carvalho wrote:
> >From 2f1490c5e8e2a393d9376d959e2ff6836757f51a Mon Sep 17 00:00:00 2001
> From: Raphael S.Carvalho <utroz@...coders.com>
> Date: Fri, 11 May 2012 22:58:43 -0300
> Subject: [PATCH 1/1] kernel/trace: gcc warning: uninitialized variable.
> 
> I've received a problem in this file when I was compiling my own kernel.
> It's a simple uninitialized variable, so that gcc is warning about it.
> 
> The function is actually working correctly, because it's impossible to use the
> variable(page2) uninitialized because it's only referenced if nr_pages == 2,
> and we will have previously set it in that case.

Correct.

> 
> gcc version 4.5.2 (GCC) - Follows the warning:

It's a bug in gcc. If you use gcc 4.6 or later it does not warn.

As this code may change in the future, I don't want to hide errors that
gcc 4.6 could catch. Thus I'm not going to take this patch.

Don't feel bad, you're probably the 5th person I declined this change
from. At least you noticed that it was just gcc complaining and did not
blindly set the variable to NULL.

-- Steve

> kernel/trace/trace.c:3755:8 warning: 'page2': may be used uninitialized in this function
> 
> Signed-off-by: Raphael S.Carvalho <utroz@...coders.com>
> ---
>  kernel/trace/trace.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
> index 2a22255..4ffff83 100644
> --- a/kernel/trace/trace.c
> +++ b/kernel/trace/trace.c
> @@ -3752,7 +3752,7 @@ tracing_mark_write(struct file *filp, const char __user *ubuf,
>      int nr_pages = 1;
>      ssize_t written;
>      void *page1;
> -    void *page2;
> +    void *uninitialized_var(page2);
>      int offset;
>      int size;
>      int len;


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ