Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

staging: rts5208: rtsx.c: Fix invalid use of sizeof in rtsx_probe()

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>

authored by

Wei Yongjun and committed by
Greg Kroah-Hartman
ef5aa934 d298ec65

+1 -1
+1 -1
drivers/staging/rts5208/rtsx.c
··· 884 884 dev = host_to_rtsx(host); 885 885 memset(dev, 0, sizeof(struct rtsx_dev)); 886 886 887 - dev->chip = kzalloc(sizeof(dev->chip), GFP_KERNEL); 887 + dev->chip = kzalloc(sizeof(*dev->chip), GFP_KERNEL); 888 888 if (!dev->chip) { 889 889 err = -ENOMEM; 890 890 goto errout;