All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Michael S. Tsirkin" <mst@redhat.com>
To: Josh Triplett <josh@kernel.org>
Cc: linux-sparse@vger.kernel.org
Subject: sparse false positive in net/packet/af_packet.c
Date: Wed, 26 Nov 2014 15:52:07 +0200	[thread overview]
Message-ID: <20141126135207.GA5480@redhat.com> (raw)

sparse triggers warnings in net/packet/af_packet.c
in upstream Linux.
This is with sparse 0.5.0 in Fedora 20.
See below for more info.

I worked around this in source, but I think it's
a good idea to fix it in sparse as well, isn't it?

----- Forwarded message from "Michael S. Tsirkin" <mst@redhat.com> -----

Date: Mon, 24 Nov 2014 13:32:16 +0200
From: "Michael S. Tsirkin" <mst@redhat.com>
To: linux-kernel@vger.kernel.org
Cc: "David S. Miller" <davem@davemloft.net>, Daniel Borkmann <dborkman@redhat.com>, Eric Dumazet <edumazet@google.com>, Atzm Watanabe
	<atzm@stratosphere.co.jp>, Hannes Frederic Sowa <hannes@stressinduktion.org>, Tom Herbert <therbert@google.com>, netdev@vger.kernel.org
Subject: [PATCH] af_packet: fix sparse warning
Message-ID: <1416828696-3989-1-git-send-email-mst@redhat.com>

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

----- End forwarded message -----

                 reply	other threads:[~2014-11-26 13:52 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20141126135207.GA5480@redhat.com \
    --to=mst@redhat.com \
    --cc=josh@kernel.org \
    --cc=linux-sparse@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.