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

atm: idt77105: fix fetch_stats() result

copy_to_user() used PRIV(dev)->stats instead of local stats variable.
Zero stats were returned to user in case of (zero != 0), also memcpy()
was pointless.

Signed-off-by: Vasiliy Kulikov <segoon@openwall.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Vasiliy Kulikov and committed by
David S. Miller
2221eca0 9190b3b3

+1 -1
+1 -1
drivers/atm/idt77105.c
··· 151 151 spin_unlock_irqrestore(&idt77105_priv_lock, flags); 152 152 if (arg == NULL) 153 153 return 0; 154 - return copy_to_user(arg, &PRIV(dev)->stats, 154 + return copy_to_user(arg, &stats, 155 155 sizeof(struct idt77105_stats)) ? -EFAULT : 0; 156 156 } 157 157