Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1501686

Re: [PATCH] UBI: Fix crash in try_recover_peb()

From Geert Uytterhoeven <geert@linux-m68k.org>
Newsgroups linux.kernel
Subject Re: [PATCH] UBI: Fix crash in try_recover_peb()
Date 2016-10-17 10:10 +0200
Message-ID <stb9D-Tq-3@gated-at.bofh.it> (permalink)
References <srPbb-4G0-11@gated-at.bofh.it> <srPbc-4G0-35@gated-at.bofh.it> <ss8dP-9Z-7@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Hi Boris,

On Fri, Oct 14, 2016 at 12:49 PM, Boris Brezillon
<boris.brezillon@free-electrons.com> wrote:
> On Thu, 13 Oct 2016 16:24:58 +0200
> Boris Brezillon <boris.brezillon@free-electrons.com> wrote:
>> On Thu, 13 Oct 2016 16:05:36 +0200
>> Geert Uytterhoeven <geert@linux-m68k.org> wrote:
>>
>> >     drivers/mtd/ubi/eba.c: In function ‘try_recover_peb’:
>> >     drivers/mtd/ubi/eba.c:744: warning: ‘vid_hdr’ is used uninitialized in this function
>> >
>> > The pointer vid_hdr is indeed not initialized, leading to a crash when
>> > it is dereferenced.
>> >
>> > Fix this by obtaining the pointer from the VID buffer, like is done
>> > everywhere else.
>>
>> Indeed, I don't know how I missed that one :-/.
>
> That's really weird. I tried to recompile the kernel on my machine
> (before applying your patch), to see if the compiler was complaining,
> and it's not :-(.
>
> I also coded simple functions with goto statements, to check that the
> detection was working correctly, and it is.
>
> Maybe you have some ideas why my compiler is failing to detect the
> problem (I'm currently using the ubuntu cross-toolchain:
> 'arm-linux-gnueabi-gcc (Ubuntu/Linaro 5.4.0-6ubuntu1~16.04.1) 5.4.0
> 20160609').

It depends highly on the toolchain.

My good old m68k-linux-gnu-gcc version 4.1.2 20061115 (prerelease) (Ubuntu
4.1.1-21) is known to generate plenty of warnings like these. Due to the high
percentage of false positives, this was disabled in later versions of gcc, but
(partially) re-enabled later (usually Arnd catches most of these while stll in
-next. I'm afraid he's suffering from travelling to Linaro Connect ;-)
Still, some of them are real bugs, so that's when my patch habits kick in...

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH] UBI: Fix crash in try_recover_peb() Geert Uytterhoeven <geert@linux-m68k.org> - 2016-10-13 16:30 +0200
  Re: [PATCH] UBI: Fix crash in try_recover_peb() Boris Brezillon <boris.brezillon@free-electrons.com> - 2016-10-13 16:30 +0200
    Re: [PATCH] UBI: Fix crash in try_recover_peb() Boris Brezillon <boris.brezillon@free-electrons.com> - 2016-10-14 12:50 +0200
      Re: [PATCH] UBI: Fix crash in try_recover_peb() Geert Uytterhoeven <geert@linux-m68k.org> - 2016-10-17 10:10 +0200
    Re: [PATCH] UBI: Fix crash in try_recover_peb() Geert Uytterhoeven <geert@linux-m68k.org> - 2016-10-17 10:10 +0200
      Re: [PATCH] UBI: Fix crash in try_recover_peb() Boris Brezillon <boris.brezillon@free-electrons.com> - 2016-10-17 13:10 +0200
        Re: [PATCH] UBI: Fix crash in try_recover_peb() Geert Uytterhoeven <geert@linux-m68k.org> - 2016-10-17 13:20 +0200

csiph-web