From: Joe Perches <joe@perches.com>
To: Kees Cook <keescook@chromium.org>,
Linus Walleij <linus.walleij@linaro.org>
Cc: Pramod Kumar <pramod.kumar@broadcom.com>,
Andrew Lunn <andrew@lunn.ch>,
Florian Fainelli <f.fainelli@gmail.com>,
"David S. Miller" <davem@davemloft.net>,
linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] mdio-mux-gpio: Remove VLA usage
Date: Tue, 29 May 2018 16:19:02 -0700 [thread overview]
Message-ID: <56a8f4d988151f94950b355dba6ab83b5dfdb9c2.camel@perches.com> (raw)
In-Reply-To: <20180529225901.GA30464@beast>
On Tue, 2018-05-29 at 15:59 -0700, Kees Cook wrote:
> In the quest to remove all stack VLA usage from the kernel[1], this
> allocates the values buffer during the callback instead of putting it
> on the stack.
>
> [1] https://lkml.kernel.org/r/CA+55aFzCG-zNmZwX4A2FQpadafLfEzK6CC=qPXydAacU1RqZWA@mail.gmail.com
[]
> diff --git a/drivers/net/phy/mdio-mux-gpio.c b/drivers/net/phy/mdio-mux-gpio.c
[]
> @@ -26,18 +26,23 @@ static int mdio_mux_gpio_switch_fn(int current_child, int desired_child,
> void *data)
> {
> struct mdio_mux_gpio_state *s = data;
> - int values[s->gpios->ndescs];
> + int *values;
> unsigned int n;
>
> if (current_child == desired_child)
> return 0;
>
> + values = kmalloc_array(s->gpios->ndescs, sizeof(*values), GFP_KERNEL);
> + if (!values)
> + return -ENOMEM;
This function previously only returned 0
and now it can return -ENOMEM.
How do you know all the indirect callers
via the switch_fn stored in mdio_mux_init
can handle the new return value?
If you have explored these code paths, it
would be good to explain that in the commit
message.
next prev parent reply other threads:[~2018-05-29 23:19 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-05-29 22:59 Kees Cook
2018-05-29 23:19 ` Joe Perches [this message]
2018-05-30 0:57 ` Andrew Lunn
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=56a8f4d988151f94950b355dba6ab83b5dfdb9c2.camel@perches.com \
--to=joe@perches.com \
--cc=andrew@lunn.ch \
--cc=davem@davemloft.net \
--cc=f.fainelli@gmail.com \
--cc=keescook@chromium.org \
--cc=linus.walleij@linaro.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=pramod.kumar@broadcom.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®