staging: rts5208: rtsx.c: Fix invalid use of sizeof in rtsx_probe()
authorWei Yongjun <weiyongjun1@huawei.com>
Mon, 17 Oct 2016 23:35:49 +0000 (23:35 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 25 Oct 2016 07:59:48 +0000 (09:59 +0200)
sizeof() when applied to a pointer typed expression gives the
size of the pointer, not that of the pointed data.

Fixes: 2eb9d8cbb3c3 ("staging: rts5208: rtsx.c: Alloc sizeof struct")
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/rts5208/rtsx.c

index f3e5efdf0ffcf54a4aa2b1977ae13ec1e32911de..68d75d0d5efd0c394145a2df802d0a12c490b459 100644 (file)
@@ -884,7 +884,7 @@ static int rtsx_probe(struct pci_dev *pci,
        dev = host_to_rtsx(host);
        memset(dev, 0, sizeof(struct rtsx_dev));
 
-       dev->chip = kzalloc(sizeof(dev->chip), GFP_KERNEL);
+       dev->chip = kzalloc(sizeof(*dev->chip), GFP_KERNEL);
        if (!dev->chip) {
                err = -ENOMEM;
                goto errout;