Skip to contentSkip to conversation

drivers/isdn/pcbit/* - compile warning

PATCH In review Stephen Biggs 1 participant 1 message Feb 14, 2005 Kernel janitors

lore
Share & tools
lore
#0 lore raw

PATCH 7/21 drivers/isdn/pcbit/* - compile warning

Description: compile warning cleanup - handle copy_to/from_user error returns

drivers/isdn/pcbit/drv.c +9 -6
diff -Nurdp -X dontdiff-osdl linux-2.6.11-rc3-mm2-original/drivers/isdn/pcbit/drv.c linux-2.6.11-rc3-mm2/drivers/isdn/pcbit/drv.c
@@ -727,23 +727,26 @@ int pcbit_stat(u_char __user *buf, int l
 
 	if (stat_st < stat_end)
 	{
-		copy_to_user(buf, statbuf + stat_st, len);
+		if (copy_to_user(buf, statbuf + stat_st, len))
+			return -EFAULT;
 		stat_st += len;	   
 	}
 	else
 	{
 		if (len > STATBUF_LEN - stat_st)
 		{
-			copy_to_user(buf, statbuf + stat_st, 
-				       STATBUF_LEN - stat_st);
-			copy_to_user(buf, statbuf, 
-				       len - (STATBUF_LEN - stat_st));
+			if (copy_to_user(buf, statbuf + stat_st, 
+				       STATBUF_LEN - stat_st) ||
+				copy_to_user(buf, statbuf, 
+				       len - (STATBUF_LEN - stat_st)))
+				return -EFAULT;
 
 			stat_st = len - (STATBUF_LEN - stat_st);
 		}
 		else
 		{
-			copy_to_user(buf, statbuf + stat_st, len);
+			if (copy_to_user(buf, statbuf + stat_st, len))
+				return -EFAULT;
 
 			stat_st += len;
 			

_______________________________________________
Kernel-janitors mailing list
[email protected]
http://lists.osdl.org/mailman/listinfo/kernel-janitors