Thread (3 messages) flat view 3 messages, 2 authors, 2018-06-25

Re: [PATCH v3 net-next] mdio-mux-gpio: Remove VLA usage

From: Joe Perches <joe@perches.com>
Date: 2018-06-25 22:23:14
Also in: lkml

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.
[]
quoted hunk ↗ jump to hunk
diff --git a/drivers/net/phy/mdio-mux-gpio.c b/drivers/net/phy/mdio-mux-gpio.c
[]
quoted hunk ↗ jump to hunk
@@ -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()
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help