linux-next.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* mm/vmalloc.c:4691:25: error: variable 'addr' is uninitialized when used here [-Werror,-Wuninitialized]
@ 2024-01-11 10:53 Naresh Kamboju
  2024-01-11 11:16 ` Dan Carpenter
  0 siblings, 1 reply; 5+ messages in thread
From: Naresh Kamboju @ 2024-01-11 10:53 UTC (permalink / raw)
  To: Linux-Next Mailing List, open list, Linux Regressions,
	clang-built-linux, lkft-triage
  Cc: Andrew Morton, Arnd Bergmann, Dan Carpenter

Following build failures noticed on i386 and x86 with clang builds on the
Linux next-20240111 tag.

Reported-by: Linux Kernel Functional Testing <lkft@linaro.org>

Build error:
----------
mm/vmalloc.c:4691:25: error: variable 'addr' is uninitialized when
used here [-Werror,-Wuninitialized]
 4691 |                 va = __find_vmap_area(addr, &vn->busy.root);
      |                                       ^~~~
mm/vmalloc.c:4684:20: note: initialize the variable 'addr' to silence
this warning
 4684 |         unsigned long addr;
      |                           ^
      |                            = 0
1 error generated.

Links:
 - https://qa-reports.linaro.org/lkft/linux-next-master/build/next-20240111/testrun/22036090/suite/build/test/clang-lkftconfig/details/

--
Linaro LKFT
https://lkft.linaro.org

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: mm/vmalloc.c:4691:25: error: variable 'addr' is uninitialized when used here [-Werror,-Wuninitialized]
  2024-01-11 10:53 mm/vmalloc.c:4691:25: error: variable 'addr' is uninitialized when used here [-Werror,-Wuninitialized] Naresh Kamboju
@ 2024-01-11 11:16 ` Dan Carpenter
  2024-01-11 12:55   ` Arnd Bergmann
  0 siblings, 1 reply; 5+ messages in thread
From: Dan Carpenter @ 2024-01-11 11:16 UTC (permalink / raw)
  To: Naresh Kamboju, Uladzislau Rezki
  Cc: Linux-Next Mailing List, open list, Linux Regressions,
	clang-built-linux, lkft-triage, Andrew Morton, Arnd Bergmann

On Thu, Jan 11, 2024 at 04:23:09PM +0530, Naresh Kamboju wrote:
> Following build failures noticed on i386 and x86 with clang builds on the
> Linux next-20240111 tag.
> 
> Reported-by: Linux Kernel Functional Testing <lkft@linaro.org>
> 
> Build error:
> ----------
> mm/vmalloc.c:4691:25: error: variable 'addr' is uninitialized when
> used here [-Werror,-Wuninitialized]
>  4691 |                 va = __find_vmap_area(addr, &vn->busy.root);
>       |                                       ^~~~
> mm/vmalloc.c:4684:20: note: initialize the variable 'addr' to silence
> this warning
>  4684 |         unsigned long addr;
>       |                           ^
>       |                            = 0
> 1 error generated.

We turned off uninitialized variable warnings for GCC a long time ago...
:/ I don't know if we'll be able to re-enable it in a -Werror world
although Clang seems to be managing alright so perhaps there is hope.

regards,
dan carpenter


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: mm/vmalloc.c:4691:25: error: variable 'addr' is uninitialized when used here [-Werror,-Wuninitialized]
  2024-01-11 11:16 ` Dan Carpenter
@ 2024-01-11 12:55   ` Arnd Bergmann
  2024-01-11 16:37     ` Arnd Bergmann
  0 siblings, 1 reply; 5+ messages in thread
From: Arnd Bergmann @ 2024-01-11 12:55 UTC (permalink / raw)
  To: Dan Carpenter, Naresh Kamboju, Uladzislau Rezki
  Cc: linux-next, open list, Linux Regressions, clang-built-linux,
	lkft-triage, Andrew Morton

On Thu, Jan 11, 2024, at 12:16, Dan Carpenter wrote:
> On Thu, Jan 11, 2024 at 04:23:09PM +0530, Naresh Kamboju wrote:
>> Following build failures noticed on i386 and x86 with clang builds on the
>> Linux next-20240111 tag.
>> 
>> Reported-by: Linux Kernel Functional Testing <lkft@linaro.org>
>> 
>> Build error:
>> ----------
>> mm/vmalloc.c:4691:25: error: variable 'addr' is uninitialized when
>> used here [-Werror,-Wuninitialized]
>>  4691 |                 va = __find_vmap_area(addr, &vn->busy.root);
>>       |                                       ^~~~
>> mm/vmalloc.c:4684:20: note: initialize the variable 'addr' to silence
>> this warning
>>  4684 |         unsigned long addr;
>>       |                           ^
>>       |                            = 0
>> 1 error generated.
>
> We turned off uninitialized variable warnings for GCC a long time ago...
> :/ I don't know if we'll be able to re-enable it in a -Werror world
> although Clang seems to be managing alright so perhaps there is hope.

The problem with gcc's warning is that it is non-deterministic and
in recent versions actually got more false-positives even without
-Os or -fsanitize=. Clang does not catch all that gcc does because
it doesn't track state across inline functions, but at least its
output is always the same regardless of optimization and other
options.

At least this particular one is an obvious bug and easily gets
caught by lkft and lkp even if gcc's -Wuninitilized doesn't
flag it.

    Arnd

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: mm/vmalloc.c:4691:25: error: variable 'addr' is uninitialized when used here [-Werror,-Wuninitialized]
  2024-01-11 12:55   ` Arnd Bergmann
@ 2024-01-11 16:37     ` Arnd Bergmann
  2024-01-12  2:46       ` Stephen Rothwell
  0 siblings, 1 reply; 5+ messages in thread
From: Arnd Bergmann @ 2024-01-11 16:37 UTC (permalink / raw)
  To: Dan Carpenter, Naresh Kamboju, Uladzislau Rezki
  Cc: linux-next, open list, Linux Regressions, clang-built-linux,
	lkft-triage, Andrew Morton

On Thu, Jan 11, 2024, at 13:55, Arnd Bergmann wrote:
> On Thu, Jan 11, 2024, at 12:16, Dan Carpenter wrote:
>> On Thu, Jan 11, 2024 at 04:23:09PM +0530, Naresh Kamboju wrote:
>>> Following build failures noticed on i386 and x86 with clang builds on the
>>> Linux next-20240111 tag.
>>> 
>>> Reported-by: Linux Kernel Functional Testing <lkft@linaro.org>
>>> 
>>> Build error:
>>> ----------
>>> mm/vmalloc.c:4691:25: error: variable 'addr' is uninitialized when
>>> used here [-Werror,-Wuninitialized]
>>>  4691 |                 va = __find_vmap_area(addr, &vn->busy.root);
>>>       |                                       ^~~~
>>> mm/vmalloc.c:4684:20: note: initialize the variable 'addr' to silence
>>> this warning
>>>  4684 |         unsigned long addr;
>>>       |                           ^
>>>       |                            = 0
>>> 1 error generated.
>>
>> We turned off uninitialized variable warnings for GCC a long time ago...
>> :/ I don't know if we'll be able to re-enable it in a -Werror world
>> although Clang seems to be managing alright so perhaps there is hope.
>
> The problem with gcc's warning is that it is non-deterministic and
> in recent versions actually got more false-positives even without
> -Os or -fsanitize=. Clang does not catch all that gcc does because
> it doesn't track state across inline functions, but at least its
> output is always the same regardless of optimization and other
> options.
>
> At least this particular one is an obvious bug and easily gets
> caught by lkft and lkp even if gcc's -Wuninitilized doesn't
> flag it.

As it turns out, gcc did find this one in the default -Wuninitialized
regardless of -Wmaybe-uninitialized:

mm/vmalloc.c: In function 'vmalloc_dump_obj':
mm/vmalloc.c:4691:22: error: 'addr' is used uninitialized [-Werror=uninitialized]
 4691 |                 va = __find_vmap_area(addr, &vn->busy.root);
      |                      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
mm/vmalloc.c:4684:23: note: 'addr' was declared here
 4684 |         unsigned long addr;
      |                       ^~~~

and I see that Uladzislau Rezki already sent a fix, which
is the same that I tried out in my randconfig tree:
https://lore.kernel.org/lkml/ZaARXdbigD1hWuOS@pc638.lan/

    Arnd

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: mm/vmalloc.c:4691:25: error: variable 'addr' is uninitialized when used here [-Werror,-Wuninitialized]
  2024-01-11 16:37     ` Arnd Bergmann
@ 2024-01-12  2:46       ` Stephen Rothwell
  0 siblings, 0 replies; 5+ messages in thread
From: Stephen Rothwell @ 2024-01-12  2:46 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Dan Carpenter, Naresh Kamboju, Uladzislau Rezki, linux-next,
	open list, Linux Regressions, clang-built-linux, lkft-triage,
	Andrew Morton

[-- Attachment #1: Type: text/plain, Size: 2574 bytes --]

Hi all,

On Thu, 11 Jan 2024 17:37:12 +0100 "Arnd Bergmann" <arnd@arndb.de> wrote:
>
> On Thu, Jan 11, 2024, at 13:55, Arnd Bergmann wrote:
> > On Thu, Jan 11, 2024, at 12:16, Dan Carpenter wrote:  
> >> On Thu, Jan 11, 2024 at 04:23:09PM +0530, Naresh Kamboju wrote:  
> >>> Following build failures noticed on i386 and x86 with clang builds on the
> >>> Linux next-20240111 tag.
> >>> 
> >>> Reported-by: Linux Kernel Functional Testing <lkft@linaro.org>
> >>> 
> >>> Build error:
> >>> ----------
> >>> mm/vmalloc.c:4691:25: error: variable 'addr' is uninitialized when
> >>> used here [-Werror,-Wuninitialized]
> >>>  4691 |                 va = __find_vmap_area(addr, &vn->busy.root);
> >>>       |                                       ^~~~
> >>> mm/vmalloc.c:4684:20: note: initialize the variable 'addr' to silence
> >>> this warning
> >>>  4684 |         unsigned long addr;
> >>>       |                           ^
> >>>       |                            = 0
> >>> 1 error generated.  
> >>
> >> We turned off uninitialized variable warnings for GCC a long time ago...
> >> :/ I don't know if we'll be able to re-enable it in a -Werror world
> >> although Clang seems to be managing alright so perhaps there is hope.  
> >
> > The problem with gcc's warning is that it is non-deterministic and
> > in recent versions actually got more false-positives even without
> > -Os or -fsanitize=. Clang does not catch all that gcc does because
> > it doesn't track state across inline functions, but at least its
> > output is always the same regardless of optimization and other
> > options.
> >
> > At least this particular one is an obvious bug and easily gets
> > caught by lkft and lkp even if gcc's -Wuninitilized doesn't
> > flag it.  
> 
> As it turns out, gcc did find this one in the default -Wuninitialized
> regardless of -Wmaybe-uninitialized:
> 
> mm/vmalloc.c: In function 'vmalloc_dump_obj':
> mm/vmalloc.c:4691:22: error: 'addr' is used uninitialized [-Werror=uninitialized]
>  4691 |                 va = __find_vmap_area(addr, &vn->busy.root);
>       |                      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> mm/vmalloc.c:4684:23: note: 'addr' was declared here
>  4684 |         unsigned long addr;
>       |                       ^~~~
> 
> and I see that Uladzislau Rezki already sent a fix, which
> is the same that I tried out in my randconfig tree:
> https://lore.kernel.org/lkml/ZaARXdbigD1hWuOS@pc638.lan/

I have applied that to linux-next today.

-- 
Cheers,
Stephen Rothwell

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2024-01-12  2:46 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-01-11 10:53 mm/vmalloc.c:4691:25: error: variable 'addr' is uninitialized when used here [-Werror,-Wuninitialized] Naresh Kamboju
2024-01-11 11:16 ` Dan Carpenter
2024-01-11 12:55   ` Arnd Bergmann
2024-01-11 16:37     ` Arnd Bergmann
2024-01-12  2:46       ` Stephen Rothwell

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).