[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Nano-devel] valgrind complaining about uninitialized memory
From: |
Benno Schulenberg |
Subject: |
Re: [Nano-devel] valgrind complaining about uninitialized memory |
Date: |
Wed, 27 Feb 2019 19:44:21 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.4.0 |
Op 27-02-19 om 13:57 schreef Enrico Mioso:
> I was checking the other valgrind complain: winio.c, this line:
> if (on_a_vt && ioctl(0, TIOCLINUX, &modifiers) >= 0) {
>
> was wondering what was wrong here.
Me too. I have no idea.
> Am I wrong in thinking that &modifiers is an
> address on the function stack?
You're correct. The &modifiers is an address pointing somewhere in
the function's stack.
> why does valgrind complain about us passing uninitialized memory to the ioctl
> call?
Don't know.
> Was wondering if we could avoid these valgrind errors, to make it easier to
> spot
> "real" issues in the future.
Maybe there is some option to valgrind that improves the check.
For example, when I run valgrind, I use --expensive-definedness-checks=yes
to avoid several occurrences of this:
==32641== Conditional jump or move depends on uninitialised value(s)
==32641== at 0x538613D: re_compile_fastmap_iter.isra.26 (regcomp.c:328)
==32641== [...]
But that option doesn't help with the ioctl() issue you found.
(Apparently I've never run valgrind on a Linux console before.)
Hmmm... The warning goes away when I make 'modifiers' a static variable
at the level of src/winio.c. So apparently the warning is spurious and
there is nothing actually wrong with the call.
Benno
signature.asc
Description: OpenPGP digital signature