Sensor: sx9325 malloc memory size err.
authorWen Xie <xiewen3@motorola.com>
Thu, 22 Aug 2019 11:29:39 +0000 (19:29 +0800)
committerxiest1 <xiest1@lenovo.com>
Tue, 5 Nov 2019 09:32:10 +0000 (17:32 +0800)
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 <xiewen3@motorola.com>
Reviewed-on: https://gerrit.mot.com/1407951
SME-Granted: SME Approvals Granted
SLTApproved: Slta Waiver
Tested-by: Jira Key
Reviewed-by: Xiangpo Zhao <zhaoxp3@motorola.com>
Submit-Approved: Jira Key

drivers/input/misc/sx9325_sar.c

index 7eb01fb16908ee78600c3853d00ccda47e0dd4ab..9de3d09d0d97dda74af4c26978304875608bc1d4 100755 (executable)
@@ -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;