hal/hald/linux ieee1394_class_device.c, 1.4, 1.4.2.1 ieee1394_host_class_device.c, 1.5, 1.5.2.1 ieee1394_node_class_device.c, 1.6, 1.6.2.1 pci_bus_device.c, 1.9.2.1, 1.9.2.2 usb_bus_device.c, 1.15, 1.15.2.1 usbif_bus_device.c, 1.9.2.1, 1.9.2.2

David Zeuthen david at freedesktop.org
Mon Jan 24 13:28:35 PST 2005


Update of /cvs/hal/hal/hald/linux
In directory gabe:/tmp/cvs-serv12087/hald/linux

Modified Files:
      Tag: hal-0_4-stable-branch
	ieee1394_class_device.c ieee1394_host_class_device.c 
	ieee1394_node_class_device.c pci_bus_device.c usb_bus_device.c 
	usbif_bus_device.c 
Log Message:
2005-01-24  David Zeuthen  <david at fubar.dk>

	* hald/linux/usb_bus_device.c (usb_device_pre_process): cur->len
	may be zero so don't look at sysfs attributes in that case. From
	Antti Andreimann <antti.andreimann at mail.ee>; RH bug 145921.

	* hald/linux/ieee1394_host_class_device.c:
	(ieee1394_host_class_pre_process): Same fix

	* hald/linux/ieee1394_node_class_device.c:
	(ieee1394_node_class_pre_process): Same fix

	* hald/linux/ieee1394_class_device.c:
	(ieee1394_class_pre_process): Same fix

	* hald/linux/usbif_bus_device.c (usbif_device_pre_process): Same fix

	* hald/linux/pci_bus_device.c (pci_device_pre_process): Same fix



Index: ieee1394_class_device.c
===================================================================
RCS file: /cvs/hal/hal/hald/linux/Attic/ieee1394_class_device.c,v
retrieving revision 1.4
retrieving revision 1.4.2.1
diff -u -d -r1.4 -r1.4.2.1
--- ieee1394_class_device.c	2 Aug 2004 17:49:43 -0000	1.4
+++ ieee1394_class_device.c	24 Jan 2005 21:28:32 -0000	1.4.2.1
@@ -73,16 +73,18 @@
 	sysdevice = sysfs_get_classdev_device (class_device);
 	dlist_for_each_data (sysfs_get_device_attributes (sysdevice),
 			     cur, struct sysfs_attribute) {
-		int len, i;
+		int i;
 
 		if (sysfs_get_name_from_path (cur->path,
 					      attr_name,
 					      SYSFS_NAME_LEN) != 0)
 			continue;
 
+		if (cur->len <= 0)
+			continue;
+
 		/* strip whitespace */
-		len = strlen (cur->value);
-		for (i = len - 1; i >= 0 && isspace (cur->value[i]); --i)
+		for (i = cur->len - 1; i >= 0 && isspace (cur->value[i]); --i)
 			cur->value[i] = '\0';
 
 		if (strcmp (attr_name, "model_id") == 0) {

Index: ieee1394_host_class_device.c
===================================================================
RCS file: /cvs/hal/hal/hald/linux/Attic/ieee1394_host_class_device.c,v
retrieving revision 1.5
retrieving revision 1.5.2.1
diff -u -d -r1.5 -r1.5.2.1
--- ieee1394_host_class_device.c	9 Aug 2004 18:33:29 -0000	1.5
+++ ieee1394_host_class_device.c	24 Jan 2005 21:28:32 -0000	1.5.2.1
@@ -73,16 +73,18 @@
 	sysdevice = sysfs_get_classdev_device (class_device);
 	dlist_for_each_data (sysfs_get_device_attributes (sysdevice),
 			     cur, struct sysfs_attribute) {
-		int len, i;
+		int i;
 
 		if (sysfs_get_name_from_path (cur->path,
 					      attr_name,
 					      SYSFS_NAME_LEN) != 0)
 			continue;
 
+		if (cur->len <= 0)
+			continue;
+
 		/* strip whitespace */
-		len = strlen (cur->value);
-		for (i = len - 1; i >= 0 && isspace (cur->value[i]); --i)
+		for (i = cur->len - 1; i >= 0 && isspace (cur->value[i]); --i)
 			cur->value[i] = '\0';
 
 		if (strcmp (attr_name, "is_busmgr") == 0) {

Index: ieee1394_node_class_device.c
===================================================================
RCS file: /cvs/hal/hal/hald/linux/Attic/ieee1394_node_class_device.c,v
retrieving revision 1.6
retrieving revision 1.6.2.1
diff -u -d -r1.6 -r1.6.2.1
--- ieee1394_node_class_device.c	1 Sep 2004 17:38:58 -0000	1.6
+++ ieee1394_node_class_device.c	24 Jan 2005 21:28:32 -0000	1.6.2.1
@@ -74,16 +74,18 @@
 	sysdevice = sysfs_get_classdev_device (class_device);
 	dlist_for_each_data (sysfs_get_device_attributes (sysdevice),
 			     cur, struct sysfs_attribute) {
-		int len, i;
+		int i;
 
 		if (sysfs_get_name_from_path (cur->path,
 					      attr_name,
 					      SYSFS_NAME_LEN) != 0)
 			continue;
 
+		if (cur->len <= 0)
+			continue;
+
 		/* strip whitespace */
-		len = strlen (cur->value);
-		for (i = len - 1; i >= 0 && isspace (cur->value[i]); --i)
+		for (i = cur->len - 1; i >= 0 && isspace (cur->value[i]); --i)
 			cur->value[i] = '\0';
 
 		if (strcmp (attr_name, "capabilities") == 0) {

Index: pci_bus_device.c
===================================================================
RCS file: /cvs/hal/hal/hald/linux/Attic/pci_bus_device.c,v
retrieving revision 1.9.2.1
retrieving revision 1.9.2.2
diff -u -d -r1.9.2.1 -r1.9.2.2
--- pci_bus_device.c	20 Jan 2005 17:03:54 -0000	1.9.2.1
+++ pci_bus_device.c	24 Jan 2005 21:28:32 -0000	1.9.2.2
@@ -393,7 +393,6 @@
 			struct sysfs_device *device)
 {
 	int i;
-	int len;
 	int vendor_id = 0;
 	int product_id = 0;
 	int subsys_vendor_id = 0;
@@ -410,7 +409,7 @@
 	dlist_for_each_data (sysfs_get_device_attributes (device), cur,
 			     struct sysfs_attribute) {
 
-		if (cur == NULL || cur->path == NULL || cur->value == NULL || strlen (cur->value) == 0)
+		if (cur == NULL || cur->path == NULL || cur->value == NULL || cur->len <= 0 || strlen (cur->value) == 0)
 			continue;
 
 		if (sysfs_get_name_from_path (cur->path,
@@ -419,8 +418,7 @@
 			continue;
 
 		/* strip whitespace */
-		len = strlen (cur->value);
-		for (i = len - 1; isspace (cur->value[i]); --i)
+		for (i = cur->len - 1; i >= 0 && isspace (cur->value[i]); --i)
 			cur->value[i] = '\0';
 
 		/*printf("attr_name=%s -> '%s'\n", attr_name, cur->value); */

Index: usb_bus_device.c
===================================================================
RCS file: /cvs/hal/hal/hald/linux/Attic/usb_bus_device.c,v
retrieving revision 1.15
retrieving revision 1.15.2.1
diff -u -d -r1.15 -r1.15.2.1
--- usb_bus_device.c	14 Oct 2004 18:51:12 -0000	1.15
+++ usb_bus_device.c	24 Jan 2005 21:28:33 -0000	1.15.2.1
@@ -812,7 +812,6 @@
 	char *product_name_kernel = NULL;
 	char numeric_name[32];
 	struct sysfs_attribute *cur;
-	int len;
 
 	dlist_for_each_data (sysfs_get_device_attributes (device), cur,
 			     struct sysfs_attribute) {
@@ -822,9 +821,11 @@
 					      SYSFS_NAME_LEN) != 0)
 			continue;
 
+		if (cur->len <= 0)
+			continue;
+
 		/* strip whitespace */
-		len = strlen (cur->value);
-		for (i = len - 1; i >= 0 && isspace (cur->value[i]); --i)
+		for (i = cur->len - 1; i >= 0 && isspace (cur->value[i]); --i)
 			cur->value[i] = '\0';
 
 		/*printf("attr_name=%s -> '%s'\n", attr_name, cur->value); */
@@ -839,8 +840,7 @@
 		else if (strcmp (attr_name, "bMaxPower") == 0)
 			hal_device_property_set_int (d, "usb_device.max_power",
 					     parse_dec (cur->value));
-		else if (strcmp (attr_name, "serial") == 0
-			 && strlen (cur->value) > 0)
+		else if (strcmp (attr_name, "serial") == 0 && cur->len > 0)
 			hal_device_property_set_string (d, "usb_device.serial",
 						cur->value);
 		else if (strcmp (attr_name, "bmAttributes") == 0) {

Index: usbif_bus_device.c
===================================================================
RCS file: /cvs/hal/hal/hald/linux/Attic/usbif_bus_device.c,v
retrieving revision 1.9.2.1
retrieving revision 1.9.2.2
diff -u -d -r1.9.2.1 -r1.9.2.2
--- usbif_bus_device.c	22 Jan 2005 01:35:27 -0000	1.9.2.1
+++ usbif_bus_device.c	24 Jan 2005 21:28:33 -0000	1.9.2.2
@@ -190,7 +190,6 @@
 			  struct sysfs_device *device)
 {
 	int i;
-	int len;
 	struct sysfs_attribute *cur;
 	char attr_name[SYSFS_NAME_LEN];
 	const char *parent_udi;
@@ -213,9 +212,11 @@
 					      SYSFS_NAME_LEN) != 0)
 			continue;
 
+		if (cur->len <= 0)
+			continue;
+
 		/* strip whitespace */
-		len = strlen (cur->value);
-		for (i = len - 1; i > 0 && isspace (cur->value[i]); --i)
+		for (i = cur->len - 1; i >= 0 && isspace (cur->value[i]); --i)
 			cur->value[i] = '\0';
 
 		/*printf("attr_name=%s -> '%s'\n", attr_name, cur->value); */




More information about the hal-commit mailing list