driver: floppy: fix warning in __alloc_pages
Subsystems (2)
PATCH 1/1 driver: floppy: fix warning in __alloc_pages
If the user-provided length (ptr->length) is longer than one threshold, it will trigger a warning in __alloc_pages.
Fix this by checking get_order(ptr->length) >= MAX_ORDER.
Signed-off-by Dongliang Mu <[email protected]>
--- drivers/block/floppy.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/block/floppy.c +2 -0
@@ -3109,6 +3109,8 @@ static int raw_cmd_copyin(int cmd, void __user *param,if (ptr->flags & (FD_RAW_READ |FD_RAW_WRITE )) {if (ptr->length <=0 )return -EINVAL ; +if (get_order (ptr->length) >=MAX_ORDER ) +return -EINVAL ; ptr->kernel_data = (char *)fd_dma_mem_alloc (ptr->length);fallback_on_nodma_alloc (&ptr->kernel_data, ptr->length);if (!ptr->kernel_data)
Signature · 1 line
2.25.1