* [PATCH] af_packet: fix sparse warning
@ 2014-11-24 11:32 Michael S. Tsirkin
2014-11-24 21:16 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: Michael S. Tsirkin @ 2014-11-24 11:32 UTC (permalink / raw)
To: linux-kernel
Cc: David S. Miller, Daniel Borkmann, Eric Dumazet, Atzm Watanabe,
Hannes Frederic Sowa, Tom Herbert, netdev
af_packet produces lots of these:
net/packet/af_packet.c:384:39: warning: incorrect type in return expression (different modifiers)
net/packet/af_packet.c:384:39: expected struct page [pure] *
net/packet/af_packet.c:384:39: got struct page *
this seems to be because sparse does not realize that _pure
refers to function, not the returned pointer.
Tweak code slightly to avoid the warning.
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
net/packet/af_packet.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c
index d4a877e..586229a 100644
--- a/net/packet/af_packet.c
+++ b/net/packet/af_packet.c
@@ -378,7 +378,7 @@ static void unregister_prot_hook(struct sock *sk, bool sync)
__unregister_prot_hook(sk, sync);
}
-static inline __pure struct page *pgv_to_page(void *addr)
+static inline struct page * __pure pgv_to_page(void *addr)
{
if (is_vmalloc_addr(addr))
return vmalloc_to_page(addr);
--
MST
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] af_packet: fix sparse warning
2014-11-24 11:32 [PATCH] af_packet: fix sparse warning Michael S. Tsirkin
@ 2014-11-24 21:16 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2014-11-24 21:16 UTC (permalink / raw)
To: mst; +Cc: linux-kernel, dborkman, edumazet, atzm, hannes, therbert, netdev
From: "Michael S. Tsirkin" <mst@redhat.com>
Date: Mon, 24 Nov 2014 13:32:16 +0200
> af_packet produces lots of these:
> net/packet/af_packet.c:384:39: warning: incorrect type in return expression (different modifiers)
> net/packet/af_packet.c:384:39: expected struct page [pure] *
> net/packet/af_packet.c:384:39: got struct page *
>
> this seems to be because sparse does not realize that _pure
> refers to function, not the returned pointer.
>
> Tweak code slightly to avoid the warning.
>
> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Applied, please report the sparse bug if you haven't already.
Thanks.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2014-11-24 21:16 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-11-24 11:32 [PATCH] af_packet: fix sparse warning Michael S. Tsirkin
2014-11-24 21:16 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).