summaryrefslogtreecommitdiff
path: root/include/linux
diff options
context:
space:
mode:
authorIan Abbott <abbotti@mev.co.uk>2014-09-12 12:19:55 +0100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2014-09-19 15:39:39 -0700
commit9c97e588d82e90ca74488cd16e8f804cbec75978 (patch)
treef72edefe859c240b6981a12a436a47ba18de400d /include/linux
parentdf567feb00277ddee715f61e4616eaae50532ea0 (diff)
staging: comedi: addi_apci_3120: don't overallocate DMA buffer
The last parameter of `__get_free_pages()` is log2 (the 'order') of the number of pages to be allocated. This driver seems to think it is the linear number of pages, so `apci3120_auto_attach()` first tries to allocate 16 pages, but only uses 4 of them, setting the buffer size to PAGE_SIZE multiplied by the 'order'. If the allocation fails, it tries progressively smaller orders, down to 0. If the allocation at order 0 succeeds, the buffer size is set to 0, which is likely to cause problems. Set the buffer size to `PAGE_SIZE` shifted left by the allocation order. Since the maximum buffer size previously used was 4, start with an allocation order of 2 instead of 4. Rename the `ui_DmaBufferPages` member of `struct addi_private` to `ui_DmaBufferPageOrder` and rename the `pages` local variable to `order` to make it clearer what it is. Note: `struct addi_private` is used by some other ADDI-DATA drivers as well, but this is the only one using the affected members. Signed-off-by: Ian Abbott <abbotti@mev.co.uk> Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'include/linux')
0 files changed, 0 insertions, 0 deletions