driver: hid-nvidia-blake: fix allocation size of loc
Pritesh Raithatha [Tue, 17 Nov 2015 12:31:32 +0000 (17:31 +0530)]
Bug 200116059
Bug 200159297

Coverity id: 13435, 13439

Change-Id: I8d777b745b2f8b6722d8bc0e21c634449594ed4f
Signed-off-by: Pritesh Raithatha <praithatha@nvidia.com>
Reviewed-on: http://git-master/r/836880
Reviewed-by: Vinayak Pane <vpane@nvidia.com>

drivers/hid/hid-nvidia-blake.c

index 8828e33..a75fbb4 100644 (file)
@@ -415,9 +415,7 @@ static int nvidia_probe(struct hid_device *hdev, const struct hid_device_id *id)
        int ret;
        struct nvidia_tp_loc *loc;
 
-       loc = (struct nvidia_tp_loc *)
-               kmalloc(sizeof(struct nvidia_tp_loc *), GFP_KERNEL);
-
+       loc = kmalloc(sizeof(*loc), GFP_KERNEL);
        if (!loc) {
                hid_err(hdev, "cannot alloc device touchpad state\n");
                return -ENOMEM;