Sensor: sx9325 malloc memory size err.
authorWen Xie <xiewen3@motorola.com>
Thu, 22 Aug 2019 11:29:39 +0000 (19:29 +0800)
committerCosmin Tanislav <demonsingur@gmail.com>
Mon, 22 Apr 2024 17:23:59 +0000 (20:23 +0300)
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;