Package: libsysfs1
Version: 1.2.0-5
Severity: important

The sysfs_write_attribute() does not work correctly.

If you look at lib/sysfs_dir.c:197, there is the check whether the old
value is the same as the new value:

                if ((strncmp(sysattr->value, new_value, sysattr->len)) == 0) {

However, this means that only as many bytes are compared as is the
length of the old attribute. So, if the original attribute's length was
zero, it does NEVER get updated!

I found this bug while trying in vain to get my PCMCIA socket to work
on Linux 2.6.15 using pcmciautils-012. Because the pcmcia-socket-startup
sets up the available I/O port and memory regions in
/sys/class/pcmcia_socket/pcmcia_socket%d/available_resources_(io|memory)
and that file is initially empty, the bug mentioned above effectively
prevents the PCMCIA socket initialization from working. (It never adds
any ports or memory regions, since the above condition is always true
for an empty file.)

I do not know why there is a strncmp(), but my proposal is to replace it
with a strcmp() and possibly check whether this bug is fixed in the
newest versions upstream.

-- System Information:
Debian Release: 3.1
Architecture: i386 (i686)
Kernel: Linux 2.6.15
Locale: LANG=cs_CZ.UTF-8, LC_CTYPE=cs_CZ.UTF-8 (charmap=UTF-8)

Versions of packages libsysfs1 depends on:
ii  libc6                       2.3.2.ds1-22 GNU C Library: Shared libraries an

-- no debconf information


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to