mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
synced 2025-01-07 14:32:23 +00:00
genwqe: fix MAX_ORDER usage
MAX_ORDER is not inclusive: the maximum allocation order buddy allocator can deliver is MAX_ORDER-1. Fix MAX_ORDER usage in genwqe driver. Link: https://lkml.kernel.org/r/20230315113133.11326-6-kirill.shutemov@linux.intel.com Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com> Cc: Frank Haverkamp <haver@linux.ibm.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
This commit is contained in:
parent
50c00d2c68
commit
fd54349ddb
@ -443,7 +443,7 @@ static int genwqe_mmap(struct file *filp, struct vm_area_struct *vma)
|
||||
if (vsize == 0)
|
||||
return -EINVAL;
|
||||
|
||||
if (get_order(vsize) > MAX_ORDER)
|
||||
if (get_order(vsize) >= MAX_ORDER)
|
||||
return -ENOMEM;
|
||||
|
||||
dma_map = kzalloc(sizeof(struct dma_mapping), GFP_KERNEL);
|
||||
|
@ -308,7 +308,7 @@ int genwqe_alloc_sync_sgl(struct genwqe_dev *cd, struct genwqe_sgl *sgl,
|
||||
sgl->write = write;
|
||||
sgl->sgl_size = genwqe_sgl_size(sgl->nr_pages);
|
||||
|
||||
if (get_order(sgl->sgl_size) > MAX_ORDER) {
|
||||
if (get_order(sgl->sgl_size) >= MAX_ORDER) {
|
||||
dev_err(&pci_dev->dev,
|
||||
"[%s] err: too much memory requested!\n", __func__);
|
||||
return ret;
|
||||
|
Loading…
Reference in New Issue
Block a user