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: Binary output with byte granularity


On Tue, 2007-10-16 at 10:24 -0400, Martin Hunt wrote:

> function dump_binary (num:long, addr:long)
> %{
> 	char *inptr = (char *)(unsigned long)THIS->addr;
>         char *ptr = _stp_reserve_bytes(THIS->num);
>         if (likely(ptr != NULL))
> 		memcpy(ptr, inptr, THIS->num);

BTW, don't really do memcpy unless you are certain it is safe. Use an
appropriate safe copy function here. copy_from_user, deref, etc.

Martin




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