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]

Re: kread() and NULL pointers


Roland McGrath wrote:
Does kread() generate an error if you pass it a NULL pointer?

Yes. It's safely caught like all errors, but it only returns successfully when given a valid pointer.

So should the following generate an error? It doesn't. It just prints "ptr = 0" and exits.


function test_addr:long () %{
       void *nullptr = NULL;
       THIS->__retvalue = (long) kread(&(nullptr));
       CATCH_DEREF_FAULT();
%}


probe begin { ptr = test_addr() printf("ptr = %d\n", ptr) exit() }


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