socsvn commit: r272382 - soc2014/astarasikov/head/sys/dev/ofw

astarasikov at FreeBSD.org astarasikov at FreeBSD.org
Thu Aug 14 04:13:27 UTC 2014


Author: astarasikov
Date: Thu Aug 14 04:13:25 2014
New Revision: 272382
URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=272382

Log:
  [ofw]: workaround strlcat corruption on goldfish
  
  	After enabling the MMC driver, I have experienced that the
  	argument to strlcat always pointed to invalid memory.
  	To allow me to debug the driver, I have implemented an ugly hack
  

Modified:
  soc2014/astarasikov/head/sys/dev/ofw/ofw_bus_subr.c

Modified: soc2014/astarasikov/head/sys/dev/ofw/ofw_bus_subr.c
==============================================================================
--- soc2014/astarasikov/head/sys/dev/ofw/ofw_bus_subr.c	Wed Aug 13 22:34:14 2014	(r272381)
+++ soc2014/astarasikov/head/sys/dev/ofw/ofw_bus_subr.c	Thu Aug 14 04:13:25 2014	(r272382)
@@ -82,6 +82,7 @@
 ofw_bus_gen_child_pnpinfo_str(device_t cbdev, device_t child, char *buf,
     size_t buflen)
 {
+	printf("%s: buflen=%x\n", __func__, buflen);
 
 	if (ofw_bus_get_name(child) != NULL) {
 		strlcat(buf, "name=", buflen);
@@ -90,6 +91,10 @@
 
 	if (ofw_bus_get_compat(child) != NULL) {
 		strlcat(buf, " compat=", buflen);
+		if (ofw_bus_get_compat(child) < (char*)0xc0000000) {
+			printf("%s: bad compat ptr %p\n", __func__, ofw_bus_get_compat(child));
+			return (0);	
+		}
 		strlcat(buf, ofw_bus_get_compat(child), buflen);
 	}
 	return (0);


More information about the svn-soc-all mailing list