memcpy_fromiovec problems....

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi guys,

I need some help with memcpy_fromiovec. I am trying to send a skb with
iovec with the codes below:
However, I keep getting an error at memcpy_fromiovec. I have traced it
to copy_from_user which uses memcpy_fromfs.
Does anyone know where the error lies?

Thanks for any advices!!!

struct msg {
	int number;
};

{
	struct sk_buff *skb;
	struct msg m;
	struct iovec *iov;
	int size = 0;
	int error = 0;
	
	int len = sizeof(struct msg);

	memset(&m, 0x00, sizeof(struct msg));
	m.number = 100;

	iov = (struct iovec*) kmalloc(sizeof(struct iovec), GFP_KERNEL);
	iov->iov_base = (void *) &m;
	iov->iov_len = sizeof(msg);

	size = len;

	if ((skb = alloc_skb(size, GFP_KERNEL))==NULL) {
		goto errmsg;
	}

	if ((error=memcpy_fromiovec(skb_put(skb, size), iov, len))!=0) {
		kfree_skb(skb);
		goto errmsg;
	}
}

--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
IRC Channel:   irc.openprojects.net / #kernelnewbies
Web Page:      http://www.kernelnewbies.org/


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux