From: Wen Xie Date: Thu, 22 Aug 2019 11:29:39 +0000 (+0800) Subject: Sensor: sx9325 malloc memory size err. X-Git-Tag: MMI-QSAS30.62-33-3~114 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=d07b20f3d05e7004013aec1f06911d4d0bfe4f14;p=GitHub%2FMotorolaMobilityLLC%2Fkernel-slsi.git Sensor: sx9325 malloc memory size err. The parameter of sizeof is the structure pointer, so the allocation size is 8,which leads memory crossing the boundary. Change-Id: I04e19739b378a948e6ae681e45bcfdacc07ff16c Signed-off-by: Wen Xie Reviewed-on: https://gerrit.mot.com/1407951 SME-Granted: SME Approvals Granted SLTApproved: Slta Waiver Tested-by: Jira Key Reviewed-by: Xiangpo Zhao Submit-Approved: Jira Key --- diff --git a/drivers/input/misc/sx9325_sar.c b/drivers/input/misc/sx9325_sar.c index 7eb01fb16908..9de3d09d0d97 100755 --- a/drivers/input/misc/sx9325_sar.c +++ b/drivers/input/misc/sx9325_sar.c @@ -1080,7 +1080,7 @@ static int sx9325_probe(struct i2c_client *client, if (sx9325_detect(client) == 0) return -ENODEV; - pplatData = kzalloc(sizeof(pplatData), GFP_KERNEL); + pplatData = kzalloc(sizeof(sx9325_platform_data_t), GFP_KERNEL); sx9325_platform_data_of_init(client, pplatData); client->dev.platform_data = pplatData;