[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAMuHMdWgK7HSqL+XWdrzDZkvmg5rb3MtykYNkS1amm5HgnOBAg@mail.gmail.com>
Date: Thu, 15 Sep 2016 22:48:06 +0200
From: Geert Uytterhoeven <geert@...ux-m68k.org>
To: SF Markus Elfring <elfring@...rs.sourceforge.net>
Cc: linux-clk <linux-clk@...r.kernel.org>,
Geert Uytterhoeven <geert+renesas@...der.be>,
Laurent Pinchart <laurent.pinchart@...asonboard.com>,
Michael Turquette <mturquette@...libre.com>,
Simon Horman <horms+renesas@...ge.net.au>,
Stephen Boyd <sboyd@...eaurora.org>,
Ulf Hansson <ulf.hansson@...aro.org>,
LKML <linux-kernel@...r.kernel.org>,
"kernel-janitors@...r.kernel.org" <kernel-janitors@...r.kernel.org>,
Julia Lawall <julia.lawall@...6.fr>
Subject: Re: [PATCH 3/4] clk/Renesas-MSTP: Less function calls in
cpg_mstp_clocks_init() after error detection
On Thu, Sep 15, 2016 at 10:40 PM, SF Markus Elfring
<elfring@...rs.sourceforge.net> wrote:
>>> * Split a condition check for memory allocation failures so that
>>> each pointer from these function calls will be checked immediately.
>>>
>>> See also background information:
>>> Topic "CWE-754: Improper check for unusual or exceptional conditions"
>>> Link: https://cwe.mitre.org/data/definitions/754.html
>>>
>>> * Return directly after a call of the function "kzalloc" failed
>>> at the beginning.
>>
>> Both calls are already close together.
>
> Can it be that an other software development concern is eventually
> overlooked because of this "neighbourship" (or is categorised with
> a lower priority)?
>
> I suggest to reconsider this design detail if it is really acceptable
> for the safe implementation of such a software module.
>
> * How much will it matter in general that one function call was performed
> in this use case without checking its return values immediately?
>
> * Should it usually be determined quicker if a required resource like
> memory could be acquired before trying the next allocation?
Note that if memory allocation fails in this driver, the system won't
boot at all. So even not checking for allocation failures at all could be
acceptable.
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
Powered by blists - more mailing lists