This is the mail archive of the
systemtap@sourceware.org
mailing list for the systemtap project.
Re: kread() and NULL pointers
- From: Mike Mason <mmlnx at us dot ibm dot com>
- To: Roland McGrath <roland at redhat dot com>
- Cc: systemtap at sourceware dot org
- Date: Mon, 16 Jul 2007 15:52:44 -0700
- Subject: Re: kread() and NULL pointers
- References: <20070716204257.F200B4D05BE@magilla.localdomain>
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()
}