From: chavey@google.com
To: davem@davemloft.net
Cc: netdev@vger.kernel.org, chavey@google.com
Subject: [PATCH] netfilter: Fix compiler warning.
Date: Wed, 09 Dec 2009 17:25:00 -0800 [thread overview]
Message-ID: <pvmhbrzboyb.fsf@chavey.mtv.corp.google.com> (raw)
Fix compiler warning "discards qualifiers from pointer target type".
The function prototype defines parameters as pointer to a constant.
Such parameters should not have their content modified in the
function.
Signed-off-by: Laurent Chavey <chavey@google.com>
---
net/ipv4/netfilter/ipt_ULOG.c | 6 ++++--
net/netfilter/xt_time.c | 6 ++++--
2 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/net/ipv4/netfilter/ipt_ULOG.c b/net/ipv4/netfilter/ipt_ULOG.c
index d32cc4b..8490f9f 100644
--- a/net/ipv4/netfilter/ipt_ULOG.c
+++ b/net/ipv4/netfilter/ipt_ULOG.c
@@ -166,6 +166,7 @@ static void ipt_ulog_packet(unsigned int hooknum,
size_t size, copy_len;
struct nlmsghdr *nlh;
struct timeval tv;
+ ktime_t tstamp;
/* ffs == find first bit set, necessary because userspace
* is already shifting groupnumber, but we need unshifted.
@@ -208,13 +209,14 @@ static void ipt_ulog_packet(unsigned int hooknum,
pm = NLMSG_DATA(nlh);
+ tstamp = skb->tstamp;
/* We might not have a timestamp, get one */
if (skb->tstamp.tv64 == 0)
- __net_timestamp((struct sk_buff *)skb);
+ tstamp = ktime_get_real();
/* copy hook, prefix, timestamp, payload, etc. */
pm->data_len = copy_len;
- tv = ktime_to_timeval(skb->tstamp);
+ tv = ktime_to_timeval(tstamp);
put_unaligned(tv.tv_sec, &pm->timestamp_sec);
put_unaligned(tv.tv_usec, &pm->timestamp_usec);
put_unaligned(skb->mark, &pm->mark);
diff --git a/net/netfilter/xt_time.c b/net/netfilter/xt_time.c
index 93acaa5..66e2a75 100644
--- a/net/netfilter/xt_time.c
+++ b/net/netfilter/xt_time.c
@@ -159,6 +159,7 @@ time_mt(const struct sk_buff *skb, const struct xt_match_param *par)
unsigned int packet_time;
struct xtm current_time;
s64 stamp;
+ ktime_t tstamp;
/*
* We cannot use get_seconds() instead of __net_timestamp() here.
@@ -169,10 +170,11 @@ time_mt(const struct sk_buff *skb, const struct xt_match_param *par)
* may happen that the same packet matches both rules if
* it arrived at the right moment before 13:00.
*/
+ tstamp = skb->tstamp;
if (skb->tstamp.tv64 == 0)
- __net_timestamp((struct sk_buff *)skb);
+ tstamp = ktime_get_real();
- stamp = ktime_to_ns(skb->tstamp);
+ stamp = ktime_to_ns(tstamp);
stamp = div_s64(stamp, NSEC_PER_SEC);
if (info->flags & XT_TIME_LOCAL_TZ)
next reply other threads:[~2009-12-10 1:25 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-12-10 1:25 chavey [this message]
2009-12-10 2:07 ` [PATCH] netfilter: Fix compiler warning David Miller
2009-12-10 4:25 ` Eric Dumazet
2009-12-10 11:26 ` Patrick McHardy
2009-12-10 17:50 ` Laurent Chavey
2009-12-10 18:53 ` Jan Engelhardt
2009-12-10 19:31 ` Eric Dumazet
-- strict thread matches above, loose matches on Subject: below --
2009-12-10 21:44 chavey
2009-12-10 22:06 ` Jan Engelhardt
2009-12-10 22:08 ` David Miller
2009-12-10 23:23 ` Jan Engelhardt
2009-12-10 23:44 ` Jan Engelhardt
2009-12-14 13:20 ` Patrick McHardy
2009-12-10 22:13 ` Andrew Morton
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=pvmhbrzboyb.fsf@chavey.mtv.corp.google.com \
--to=chavey@google.com \
--cc=davem@davemloft.net \
--cc=netdev@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 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).