Skip to contentSkip to conversation

check copy_from_user return value in rtl8712

PATCH Larry Finger 1 participant 1 message Mar 6, 2011 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): 20110306142414.GA19990@chii

#1 lore raw
Quoted 13 lines · Xiaochen Wang

Description:return -EFAULT if copy_to_user() fails

---
  drivers/staging/rtl8712/rtl871x_ioctl_linux.c |    4 ++--
  1 files changed, 2 insertions(+), 2 deletions(-)
drivers/staging/rtl8712/rtl871x_ioctl_linux.c +0 -0
index 685a7b1..8a8e682 100644
@@ -1965,9 +1965,9 @@ static int r871x_wps_start(struct net_device *dev,
  	struct _adapter *padapter = (struct _adapter *)_netdev_priv(dev);

drivers/staging/rtl8712/rtl871x_ioctl_linux.c static int r871x_wps_start(struct net_device *dev, · line 1973

Quoted 10 lines
drivers/staging/rtl8712/rtl871x_ioctl_linux.c +2 -2
  	struct iw_point *pdata =&wrqu->data;
  	u32   u32wps_start = 0;
-	unsigned int uintRet = 0;
 
-	uintRet = copy_from_user((void *)&u32wps_start, pdata->pointer, 4);
+	if (copy_from_user((void *)&u32wps_start, pdata->pointer, 4))
+		return -EFAULT;
  	if ((padapter->bDriverStopped) || (pdata == NULL))
  		return -EINVAL;
  	if (u32wps_start == 0)

ACK.

Larry