From: Stephen Kitt Date: Fri, 24 Jan 2020 22:20:51 +0000 (+0100) Subject: crypto: chelsio - remove extra allocation for chtls_dev X-Git-Tag: libata-5.7-2020-04-09~83^2~138 X-Git-Url: https://git.kernel.dk/?a=commitdiff_plain;h=f426faac80c9cca7973de10d903dc772627a5f5a;p=linux-2.6-block.git crypto: chelsio - remove extra allocation for chtls_dev chtls_uld_add allocates room for info->nports net_device structs following the chtls_dev struct, presumably because it was originally intended that the ports array would be stored there. This is suggested by the assignment which was present in initial versions and removed by c4e848586cf1 ("crypto: chelsio - remove redundant assignment to cdev->ports"): cdev->ports = (struct net_device **)(cdev + 1); This assignment was never used, being overwritten by lldi->ports immediately afterwards, and I couldn't find any uses of the memory allocated past the end of the struct. Signed-off-by: Stephen Kitt Signed-off-by: Herbert Xu --- diff --git a/drivers/crypto/chelsio/chtls/chtls_main.c b/drivers/crypto/chelsio/chtls/chtls_main.c index a038de90b2ea..9f06abd340cc 100644 --- a/drivers/crypto/chelsio/chtls/chtls_main.c +++ b/drivers/crypto/chelsio/chtls/chtls_main.c @@ -229,8 +229,7 @@ static void *chtls_uld_add(const struct cxgb4_lld_info *info) struct chtls_dev *cdev; int i, j; - cdev = kzalloc(sizeof(*cdev) + info->nports * - (sizeof(struct net_device *)), GFP_KERNEL); + cdev = kzalloc(sizeof(*cdev), GFP_KERNEL); if (!cdev) goto out;