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-prev] [day] [month] [year] [list]
Message-ID: <CAFo99gYbiKa50crxEf4YA7voRTe0qj_9aXdTBwvU=J2EjwywaA@mail.gmail.com>
Date:	Sat, 21 Jun 2014 23:32:43 +0200
From:	Rickard Strandqvist <rickard_strandqvist@...ctrumdigital.se>
To:	Geert Uytterhoeven <geert@...ux-m68k.org>
Cc:	Joe Perches <joe@...ches.com>,
	Jean-Christophe Plagniol-Villard <plagnioj@...osoft.com>,
	Tomi Valkeinen <tomi.valkeinen@...com>,
	Jingoo Han <jg1.han@...sung.com>,
	Daniel Vetter <daniel.vetter@...ll.ch>,
	Linux Fbdev development list <linux-fbdev@...r.kernel.org>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] video: fbdev: skeletonfb.c: Adding code to managing
 allocation error

Hi

Sounds like a good idea to have better error handling although it is
an example, even more important there.

At the first return nothing has been allocated, so it's ok I guess.
At the second I reflect about adding some deallocation, there are
comments on some form of goto error part which would appropriately
handle a deallocation. But all the other places in the code is just do
a return, that was why I chose to do it at the second return to.


Kind regards
Rickard Strandqvist


2014-06-21 22:48 GMT+02:00 Geert Uytterhoeven <geert@...ux-m68k.org>:
> On Sat, Jun 21, 2014 at 3:58 PM, Joe Perches <joe@...ches.com> wrote:
>> (Adding Geert, who probably wrote most of this
>>  and likely might have forgotten all of it)
>>
>> On Sat, 2014-06-21 at 15:17 +0200, Rickard Strandqvist wrote:
>>> Adding missing code for managing a memory allocation error that may occur.
>>>
>>> This was partly found using a static code analysis program called cppcheck.
>>
>> skeletonfb.c is not meant to be compiled.
>> It's a sample driver template.
>
> Yep.
>
>> Those /* goto error path */ lines are for
>> driver writers that use this to figure out
>> what to do.
>
> Still, it's nice if a sample driver has correct error handling.
> Just comments are not good enough as guidance for some people ;-)
>
>> The second return is not correct as it would
>> not free the first alloc'd block.
>
> Indeed. Better do it right.
>
> Gr{oetje,eeting}s,
>
>                         Geert
>
> --
> Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@...ux-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
--
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