kread() and NULL pointers

Mike Mason mmlnx@us.ibm.com
Mon Jul 16 23:10:00 GMT 2007


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()
}



More information about the Systemtap mailing list