Check the return type of copy_from_user

pull/10/head
Paul Hollinsky 2019-08-27 18:16:50 -04:00
parent 3a043ecedd
commit 17569a82a9
1 changed files with 4 additions and 2 deletions

View File

@ -592,11 +592,13 @@ static long intrepid_dev_ioctl(struct file *fp, unsigned int cmd, unsigned long
struct intrepid_netdevice *result = NULL; struct intrepid_netdevice *result = NULL;
char requestedNameBuffer[IFALIASZ] = {0}; char requestedNameBuffer[IFALIASZ] = {0};
char* requestedName = NULL; char* requestedName = NULL;
int bytesNotCopied = 0;
if ((void __user*)arg != NULL) { if ((void __user*)arg != NULL) {
copy_from_user(requestedNameBuffer, (void __user*)arg, IFALIASZ); bytesNotCopied = copy_from_user(requestedNameBuffer, (void __user*)arg, IFALIASZ);
if(bytesNotCopied != 0)
pr_warn("intrepid: %d bytes not copied for alias", bytesNotCopied);
requestedName = requestedNameBuffer; requestedName = requestedNameBuffer;
} }
ret = intrepid_add_can_if(&result, requestedName); ret = intrepid_add_can_if(&result, requestedName);
break; break;
} }