Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 14 Aug 2014 04:13:26 GMT
From:      astarasikov@FreeBSD.org
To:        svn-soc-all@FreeBSD.org
Subject:   socsvn commit: r272382 - soc2014/astarasikov/head/sys/dev/ofw
Message-ID:  <201408140413.s7E4DQeY010627@socsvn.freebsd.org>

next in thread | raw e-mail | index | archive | help
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);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201408140413.s7E4DQeY010627>