card_dev.c (110080cea0d0e4dfdb0b536e7f8a5633ead6a781) | card_dev.c (eb3ae0aa382e03a99a34edc7b42302ea342f1f60) |
---|---|
1// SPDX-License-Identifier: GPL-2.0-only |
|
1/** 2 * IBM Accelerator Family 'GenWQE' 3 * 4 * (C) Copyright IBM Corp. 2013 5 * 6 * Author: Frank Haverkamp <haver@linux.vnet.ibm.com> 7 * Author: Joerg-Stephan Vogt <jsvogt@de.ibm.com> 8 * Author: Michael Jung <mijung@gmx.net> 9 * Author: Michael Ruettger <michael@ibmra.de> | 2/** 3 * IBM Accelerator Family 'GenWQE' 4 * 5 * (C) Copyright IBM Corp. 2013 6 * 7 * Author: Frank Haverkamp <haver@linux.vnet.ibm.com> 8 * Author: Joerg-Stephan Vogt <jsvogt@de.ibm.com> 9 * Author: Michael Jung <mijung@gmx.net> 10 * Author: Michael Ruettger <michael@ibmra.de> |
10 * 11 * This program is free software; you can redistribute it and/or modify 12 * it under the terms of the GNU General Public License (version 2 only) 13 * as published by the Free Software Foundation. 14 * 15 * This program is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU General Public License for more details. | |
19 */ 20 21/* 22 * Character device representation of the GenWQE device. This allows 23 * user-space applications to communicate with the card. 24 */ 25 26#include <linux/kernel.h> --- 748 unchanged lines hidden (view full) --- 775 struct genwqe_dev *cd = cfile->cd; 776 struct pci_dev *pci_dev = cfile->cd->pci_dev; 777 struct dma_mapping *dma_map; 778 unsigned long map_addr; 779 unsigned long map_size; 780 781 if ((m->addr == 0x0) || (m->size == 0)) 782 return -EINVAL; | 11 */ 12 13/* 14 * Character device representation of the GenWQE device. This allows 15 * user-space applications to communicate with the card. 16 */ 17 18#include <linux/kernel.h> --- 748 unchanged lines hidden (view full) --- 767 struct genwqe_dev *cd = cfile->cd; 768 struct pci_dev *pci_dev = cfile->cd->pci_dev; 769 struct dma_mapping *dma_map; 770 unsigned long map_addr; 771 unsigned long map_size; 772 773 if ((m->addr == 0x0) || (m->size == 0)) 774 return -EINVAL; |
783 if (m->size > ULONG_MAX - PAGE_SIZE - (m->addr & ~PAGE_MASK)) 784 return -EINVAL; | |
785 786 map_addr = (m->addr & PAGE_MASK); 787 map_size = round_up(m->size + (m->addr & ~PAGE_MASK), PAGE_SIZE); 788 789 dma_map = kzalloc(sizeof(struct dma_mapping), GFP_KERNEL); 790 if (dma_map == NULL) 791 return -ENOMEM; 792 --- 620 unchanged lines hidden --- | 775 776 map_addr = (m->addr & PAGE_MASK); 777 map_size = round_up(m->size + (m->addr & ~PAGE_MASK), PAGE_SIZE); 778 779 dma_map = kzalloc(sizeof(struct dma_mapping), GFP_KERNEL); 780 if (dma_map == NULL) 781 return -ENOMEM; 782 --- 620 unchanged lines hidden --- |