This is the mail archive of the elfutils-devel@sourceware.org mailing list for the elfutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Fix GCC6 -Wnull-dereference warnings.


On Sat, 2016-02-13 at 00:08 +0100, Mark Wielaard wrote:
> asm_begin.c: In function ‘asm_begin’:
> asm_begin.c:62:7: error: potential null pointer dereference [-Werror=null-dereference]
>        __fsetlocking (result->out.file, FSETLOCKING_BYCALLER);
>        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> 
> We set result to NULL just before this call in case of error.
> Fixed by only calling __fsetlocking when result is not NULL.
> 
> strip.c: In function ‘handle_elf.constprop’:
> strip.c:1270:31: error: null pointer dereference [-Werror=null-dereference]
>        elf_assert ((versiondata->d_size / sizeof (Elf32_Word))
>                     ~~~~~~~~~~~^~~
> 
> src/strip.c:597:37: note: in definition of macro ‘elf_assert’
>  #define elf_assert(test) do { if (!(test)) goto illformed; } while (0)
>                                      ^~~~
> 
> That is the wrong check, we want to check shndxdata, not versiondata here.

Pushed to master.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]