patch-2.4.21 linux-2.4.21/drivers/isdn/eicon/linchr.c

Next file: linux-2.4.21/drivers/isdn/hisax/Makefile
Previous file: linux-2.4.21/drivers/isdn/avmb1/kcapi.c
Back to the patch index
Back to the overall index

diff -urN linux-2.4.20/drivers/isdn/eicon/linchr.c linux-2.4.21/drivers/isdn/eicon/linchr.c
@@ -154,17 +154,17 @@
 	klog_t *pHeadItem;
 
 	if (BufferSize < sizeof(klog_t))
-	{
-		printk(KERN_WARNING "Divas: Divalog buffer specifed a size that is too small (%d - %d required)\n",
-			BufferSize, sizeof(klog_t));
 		return -EIO;
-	}
 
 	pHeadItem = (klog_t *) DivasLogFifoRead();
 
 	if (pHeadItem)
 	{
-		memcpy(pClientLogBuffer, pHeadItem, sizeof(klog_t));
+		if(copy_to_user(pClientLogBuffer, pHeadItem, sizeof(klog_t)))
+		{
+			kfree(pHeadItem);
+			return -EFAULT;
+		}
 		kfree(pHeadItem);
 		return sizeof(klog_t);
 	}

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)