linux-hotplug.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] fix valgrind error for /sys/kernel/uids/*
@ 2008-10-17 10:28 Alan Jenkins
  2008-10-17 11:23 ` Kay Sievers
  0 siblings, 1 reply; 2+ messages in thread
From: Alan Jenkins @ 2008-10-17 10:28 UTC (permalink / raw)
  To: linux-hotplug

Kay Sievers wrote:
> On Tue, Sep 16, 2008 at 7:16 PM, Kay Sievers <kay.sievers@vrfy.org> wrote:
>   
>> On Tue, Sep 16, 2008 at 03:09, Alan Jenkins <alan-jenkins@tuffmail.co.uk> wrote:
>>     
>>> commit 8753fadf2a6ecead372e71b8bf9336cf29f9c958
>>>       
>>> Lots of the udev tests fail here.  udev_sysfs.c broke when
>>> util_resolve_sys_link() switched API.
>>>       
>> Ah, sorry, should be fixed now.
>>
>>     
>>> I'll leave this up to you - maybe
>>> your next commit is going to do away with udev_sysfs.c altogether :-).
>>>       
>> It will go away soon, yeah. We should get rid of udev_sysfs.c and
>> "struct udevice".
>>     
>
> Along with a lot of other stuff, udev_sysfs.c is gone. Also the global
> event environment is replaced by a per-device property list. The
> daemon, and everything else uses the libudev code now.
>
> It seems to work fine here, but the code may be a bit rough at the
> moment, until it has seen more testing. But, it should be pretty easy
> now to play around with a threaded version of the daemon.
>
> Thanks,
> Kay
>   
# valgrind -q ./udevd &
# udevtrigger
=16329= Invalid read of size 1
=16329=    at 0x40C9DA: udev_device_set_syspath (libudev-device.c:939)
=16329=    by 0x40DFB6: udev_monitor_receive_device
(libudev-monitor.c:318)
=16329=    by 0x411F52: main (udevd.c:889)
=16329=  Address 0x60f2507 is 1 bytes before a block of size 6 alloc'd
=16329=    at 0x4C22FAB: malloc (vg_replace_malloc.c:207)
=16329=    by 0x4EA1DD1: strdup (strdup.c:43)
=16329=    by 0x40C987: udev_device_set_syspath (libudev-device.c:926)
=16329=    by 0x40DFB6: udev_monitor_receive_device
(libudev-monitor.c:318)
=16329=    by 0x411F52: main (udevd.c:889)

The syspath in question was /sys/kernel/uids/65534.  Try this?

diff --git a/udev/lib/libudev-device.c b/udev/lib/libudev-device.c
index 65ba6e3..dd08439 100644
--- a/udev/lib/libudev-device.c
+++ b/udev/lib/libudev-device.c
@@ -936,8 +936,13 @@ int udev_device_set_syspath(struct udev_device *udev_device, const char *syspath
 	}
 
 	/* trailing number */
-	while (isdigit(udev_device->sysname[--len]))
+	while (len > 0 && isdigit(udev_device->sysname[--len]))
 		udev_device->sysnum = &udev_device->sysname[len];
+
+	/* oops, sysname is completely numeric */
+	if (len = 0)
+		udev_device->sysnum = NULL;
+
 	return 0;
 }



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] fix valgrind error for /sys/kernel/uids/*
  2008-10-17 10:28 [PATCH] fix valgrind error for /sys/kernel/uids/* Alan Jenkins
@ 2008-10-17 11:23 ` Kay Sievers
  0 siblings, 0 replies; 2+ messages in thread
From: Kay Sievers @ 2008-10-17 11:23 UTC (permalink / raw)
  To: linux-hotplug

On Fri, Oct 17, 2008 at 12:28 PM, Alan Jenkins
<alan-jenkins@tuffmail.co.uk> wrote:
> Kay Sievers wrote:
>> It seems to work fine here, but the code may be a bit rough at the
>> moment, until it has seen more testing. But, it should be pretty easy
>> now to play around with a threaded version of the daemon.

> # valgrind -q ./udevd &
> # udevtrigger
> =16329= Invalid read of size 1
> =16329=    at 0x40C9DA: udev_device_set_syspath (libudev-device.c:939)
> =16329=    by 0x40DFB6: udev_monitor_receive_device
> (libudev-monitor.c:318)
> =16329=    by 0x411F52: main (udevd.c:889)
> =16329=  Address 0x60f2507 is 1 bytes before a block of size 6 alloc'd
> =16329=    at 0x4C22FAB: malloc (vg_replace_malloc.c:207)
> =16329=    by 0x4EA1DD1: strdup (strdup.c:43)
> =16329=    by 0x40C987: udev_device_set_syspath (libudev-device.c:926)
> =16329=    by 0x40DFB6: udev_monitor_receive_device
> (libudev-monitor.c:318)
> =16329=    by 0x411F52: main (udevd.c:889)

> The syspath in question was /sys/kernel/uids/65534.

Ah, nice. Thanks, applied.

Kay

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2008-10-17 11:23 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-10-17 10:28 [PATCH] fix valgrind error for /sys/kernel/uids/* Alan Jenkins
2008-10-17 11:23 ` Kay Sievers

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).