kbuf = kmalloc(count, GFP_KERNEL);
if (kbuf == NULL)
return -ENOMEM;
- if (copy_from_user(kbuf, ubuf, count))
+ if (copy_from_user(kbuf, ubuf, count)) {
+ kfree(kbuf);
return -EFAULT;
+ }
} else
/* The buffer is already in kernel space */
kbuf = (unsigned char *) ubuf;
self->max_header_size);
if (!skb) {
spin_unlock_irqrestore(&self->spinlock, flags);
+ if (from_user)
+ kfree(kbuf);
return -ENOBUFS;
}
skb_reserve(skb, self->max_header_size);
orig_jiffies = jiffies;
/* Set poll time to 200 ms */
- poll_time = IRDA_MIN(timeout, MSECS_TO_JIFFIES(200));
+ poll_time = IRDA_MIN(timeout, msecs_to_jiffies(200));
spin_lock_irqsave(&self->spinlock, flags);
while (self->tx_skb && self->tx_skb->len) {