This is the mail archive of the
systemtap@sourceware.org
mailing list for the systemtap project.
[Bug tapsets/18263] In tty tapset, driver_name can be null, causing a script to fail when probing tty.write or tty.read
- From: "dsmith at redhat dot com" <sourceware-bugzilla at sourceware dot org>
- To: systemtap at sourceware dot org
- Date: Tue, 14 Apr 2015 16:40:11 +0000
- Subject: [Bug tapsets/18263] In tty tapset, driver_name can be null, causing a script to fail when probing tty.write or tty.read
- Auto-submitted: auto-generated
- References: <bug-18263-6586 at http dot sourceware dot org/bugzilla/>
https://sourceware.org/bugzilla/show_bug.cgi?id=18263
David Smith <dsmith at redhat dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |dsmith at redhat dot com
--- Comment #1 from David Smith <dsmith at redhat dot com> ---
Hmm, I'm not quite sure this is the right fix. A better fix might be:
driver_name = kernel_string2($tty->driver->driver_name, "NULL")
kernel_string2() returns either the string or the 2nd argument.
The only problem with the above fix is that let's say we've got a non-0 address
in driver_name, but we still can't read that value (for instance the address
isn't valid). Then we've lied and said the value was NULL when it wasn't.
Perhaps we need a kernel_string3() function, which would look like this:
====
function kernel_string3:string (addr:long) {
try { return kernel_string(addr) } catch { return sprintf("%p", addr) }
}
====
This would either return the string or return the failing address.
Then of course the code in tty.stp would look like:
driver_name = kernel_string3($tty->driver->driver_name)
(The name 'kernel_string3' could be improved.)
--
You are receiving this mail because:
You are the assignee for the bug.