* [PATCH] net: ethernet: fix call_kern.cocci warnings
@ 2017-12-17 6:43 Julia Lawall
2017-12-17 22:47 ` Linus Walleij
0 siblings, 1 reply; 2+ messages in thread
From: Julia Lawall @ 2017-12-17 6:43 UTC (permalink / raw)
To: linux-arm-kernel
From: Fengguang Wu <fengguang.wu@intel.com>
Allocation with GFP_KERNEL in code called from the function
geth_resize_freeq with locks held.
Generated by: scripts/coccinelle/locks/call_kern.cocci
Fixes: 502a2864e5e4 ("net: ethernet: Add a driver for Gemini gigabit ethernet")
Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
Signed-off-by: Julia Lawall <julia.lawall@lip6.fr>
---
The proposed change of converting the GFP_KERNEL is not necessarily the
correct one. It may be desired to unlock the lock, or to not call the
function under the lock in the first place.
tree:
https://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-nomadik.git
gemini-ethernet
head: 502a2864e5e43c51a3a2689586d9c61d060a3b7d
commit: 502a2864e5e43c51a3a2689586d9c61d060a3b7d [18/18] net: ethernet:
Add a driver for Gemini gigabit ethernet
gemini.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
--- a/drivers/net/ethernet/cortina/gemini.c
+++ b/drivers/net/ethernet/cortina/gemini.c
@@ -818,7 +818,7 @@ static int geth_setup_freeq(struct gemin
geth->freeq_ring = dma_alloc_coherent(geth->dev,
sizeof(*geth->freeq_ring) << geth->freeq_order,
- &geth->freeq_dma_base, GFP_KERNEL);
+ &geth->freeq_dma_base, GFP_ATOMIC);
if (!geth->freeq_ring)
return -ENOMEM;
if (geth->freeq_dma_base & ~DMA_Q_BASE_MASK) {
@@ -827,7 +827,7 @@ static int geth_setup_freeq(struct gemin
}
geth->freeq_page_tab = kzalloc(pages * sizeof(*geth->freeq_page_tab),
- GFP_KERNEL);
+ GFP_ATOMIC);
if (!geth->freeq_page_tab)
goto err_freeq;
^ permalink raw reply [flat|nested] 2+ messages in thread* [PATCH] net: ethernet: fix call_kern.cocci warnings
2017-12-17 6:43 [PATCH] net: ethernet: fix call_kern.cocci warnings Julia Lawall
@ 2017-12-17 22:47 ` Linus Walleij
0 siblings, 0 replies; 2+ messages in thread
From: Linus Walleij @ 2017-12-17 22:47 UTC (permalink / raw)
To: linux-arm-kernel
On Sun, Dec 17, 2017 at 7:43 AM, Julia Lawall <julia.lawall@lip6.fr> wrote:
> From: Fengguang Wu <fengguang.wu@intel.com>
>
> Allocation with GFP_KERNEL in code called from the function
> geth_resize_freeq with locks held.
>
> Generated by: scripts/coccinelle/locks/call_kern.cocci
>
> Fixes: 502a2864e5e4 ("net: ethernet: Add a driver for Gemini gigabit ethernet")
> Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
> Signed-off-by: Julia Lawall <julia.lawall@lip6.fr>
> ---
>
> The proposed change of converting the GFP_KERNEL is not necessarily the
> correct one. It may be desired to unlock the lock, or to not call the
> function under the lock in the first place.
It's better to drop the lock around the offending call. the lock was just there
to protect the interrupt registers anyway.
But thanks for finding it!
I have updated the driver patch.
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-12-17 22:47 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-12-17 6:43 [PATCH] net: ethernet: fix call_kern.cocci warnings Julia Lawall
2017-12-17 22:47 ` Linus Walleij
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox