Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

mtd: oxnas_nand: Allocating more than necessary in probe()

We only need to allocate sizeof(struct oxnas_nand_ctrl) which is 192
bytes and not sizeof(struct nand_chip) which is a much larger 3056
bytes.

Fixes: 668592492409 ("mtd: nand: Add OX820 NAND Support")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Acked-by: Neil Armstrong <narmstrong@baylibre.com>
Acked-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>

authored by

Dan Carpenter and committed by
Brian Norris
b98e1995 4ca41cb2

+1 -1
+1 -1
drivers/mtd/nand/oxnas_nand.c
··· 91 91 int err = 0; 92 92 93 93 /* Allocate memory for the device structure (and zero it) */ 94 - oxnas = devm_kzalloc(&pdev->dev, sizeof(struct nand_chip), 94 + oxnas = devm_kzalloc(&pdev->dev, sizeof(*oxnas), 95 95 GFP_KERNEL); 96 96 if (!oxnas) 97 97 return -ENOMEM;