This is the mail archive of the systemtap@sourceware.org mailing list for the systemtap project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug tapsets/18263] In tty tapset, driver_name can be null, causing a script to fail when probing tty.write or tty.read


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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]