From: Alan Jenkins <alan-jenkins@tuffmail.co.uk>
To: linux-hotplug@vger.kernel.org
Subject: [PATCH] fix valgrind error for /sys/kernel/uids/*
Date: Fri, 17 Oct 2008 10:28:02 +0000 [thread overview]
Message-ID: <48F868B2.5030800@tuffmail.co.uk> (raw)
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;
}
next reply other threads:[~2008-10-17 10:28 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-10-17 10:28 Alan Jenkins [this message]
2008-10-17 11:23 ` [PATCH] fix valgrind error for /sys/kernel/uids/* Kay Sievers
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=48F868B2.5030800@tuffmail.co.uk \
--to=alan-jenkins@tuffmail.co.uk \
--cc=linux-hotplug@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).