WARNING: This server is unstable and will be retired in the next days. If you want to keep this forum available, please request immediately a migration on the Nabble Support forum. Forums that don't receive any migration request will be deleted forever.

 « Return to Thread: [PATCH libwacom 0/5] uinput support hacks

[PATCH libwacom 1/5] lib: if no subsystem matches, don't access invalid devices

by Peter Hutterer-3 :: Rate this Message:

| View in Thread

For evemu devices, the subsystem is only input until we arrive at the NULL
parent. If that's the case, don't try to get the subsystem from a NULL
pointer but return a unknown subsystem instead.

Signed-off-by: Peter Hutterer <peter.hutterer@...>
---
 libwacom/libwacom.c |   15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/libwacom/libwacom.c b/libwacom/libwacom.c
index 811948a..103f942 100644
--- a/libwacom/libwacom.c
+++ b/libwacom/libwacom.c
@@ -60,17 +60,20 @@ get_bus (GUdevDevice *device)
  while (parent && g_strcmp0 (subsystem, "input") == 0) {
  GUdevDevice *old_parent = parent;
  parent = g_udev_device_get_parent (old_parent);
- subsystem = g_udev_device_get_subsystem (parent);
+ if (parent)
+ subsystem = g_udev_device_get_subsystem (parent);
  g_object_unref (old_parent);
  }
 
- if (g_strcmp0 (subsystem, "tty") == 0 || g_strcmp0 (subsystem, "serio") == 0)
- bus_str = g_strdup ("serial");
- else
- bus_str = g_strdup (subsystem);
+ if (parent) {
+ if (g_strcmp0 (subsystem, "tty") == 0 || g_strcmp0 (subsystem, "serio") == 0)
+ bus_str = g_strdup ("serial");
+ else
+ bus_str = g_strdup (subsystem);
 
- if (parent)
  g_object_unref (parent);
+ } else
+ bus_str = strdup("unknown");
 
  return bus_str;
 }
--
1.7.10.1


------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Linuxwacom-devel mailing list
Linuxwacom-devel@...
https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel

 « Return to Thread: [PATCH libwacom 0/5] uinput support hacks