Skip to contentSkip to conversation

Adjusting destination pointer with copy_to_user

DISCUSSION Timur Aydin 1 participant 1 message Feb 12, 2007

lore
Share & tools
lore
#0 lore raw

Hi,

I am passing a packet consisting of a fixed length header and a variable length data block to a user mode application. The user mode application passes the pointer of its buffer with an ioctl call (buff_ptr). When the driver receives buff_ptr, it makes two calls to pass the packet to user mode:

copy_to_user(buff_ptr, header, header_size); copy_to_user(buff_ptr + header_size, data, data_size);

Is this a valid usage? Or can I only use buff_ptr here?

Timur