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

ptp: Fix possible memory leak caused by invalid cast

Fixes possible leak of PTP virtual clocks.

The number of PTP virtual clocks to be unregistered is passed as
'u32', but the function that unregister the devices handles that as
'u8'.

Fixes: 73f37068d540 ("ptp: support ptp physical/virtual clocks conversion")
Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Vinicius Costa Gomes and committed by
David S. Miller
d329e41a 2383cb94

+1 -1
+1 -1
drivers/ptp/ptp_sysfs.c
··· 154 154 struct ptp_clock *ptp = dev_get_drvdata(dev); 155 155 struct ptp_clock_info *info = ptp->info; 156 156 struct ptp_vclock *vclock; 157 - u8 *num = data; 157 + u32 *num = data; 158 158 159 159 vclock = info_to_vclock(info); 160 160 dev_info(dev->parent, "delete virtual clock ptp%d\n",