[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAGXu5j+Y0gJydvqtb0mo8oZPgtWYzqwm+5fYudiUw9V5nMqwqw@mail.gmail.com>
Date: Mon, 25 Jun 2018 15:39:23 -0700
From: Kees Cook <keescook@...omium.org>
To: Joe Perches <joe@...ches.com>
Cc: "David S. Miller" <davem@...emloft.net>,
LKML <linux-kernel@...r.kernel.org>,
Andrew Lunn <andrew@...n.ch>,
Network Development <netdev@...r.kernel.org>
Subject: Re: [PATCH v3 net-next] mdio-mux-gpio: Remove VLA usage
On Mon, Jun 25, 2018 at 3:23 PM, Joe Perches <joe@...ches.com> wrote:
> On Mon, 2018-06-25 at 15:09 -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.
>
> []
>
>> diff --git a/drivers/net/phy/mdio-mux-gpio.c b/drivers/net/phy/mdio-mux-gpio.c
> []
>> @@ -44,15 +44,21 @@ static int mdio_mux_gpio_switch_fn(int current_child, int desired_child,
>> static int mdio_mux_gpio_probe(struct platform_device *pdev)
>> {
> []
>> + s = devm_kzalloc(&pdev->dev, sizeof(*s->values) * gpios->ndescs +
>> + sizeof(*s), GFP_KERNEL);
>
> Isn't this supposed to use your new struct_size()
Why yes. Yes it is. :) When treewide changes meet in the night! :)
I'll send a v4.
-Kees
--
Kees Cook
Pixel Security
Powered by blists - more mailing lists