From patchwork Fri Aug 31 04:27:37 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tushar Behera X-Patchwork-Id: 11121 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id 81A9E23EFF for ; Fri, 31 Aug 2012 04:30:13 +0000 (UTC) Received: from mail-iy0-f180.google.com (mail-iy0-f180.google.com [209.85.210.180]) by fiordland.canonical.com (Postfix) with ESMTP id 0EE90A1937B for ; Fri, 31 Aug 2012 04:29:35 +0000 (UTC) Received: by iafj25 with SMTP id j25so4171628iaf.11 for ; Thu, 30 Aug 2012 21:30:12 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-forwarded-to:x-forwarded-for:delivered-to:received-spf:from:to:cc :subject:date:message-id:x-mailer:in-reply-to:references :x-gm-message-state; bh=ZT6DTv40rbC4DdebS4Hz2s7D5Y6GDwzy00JvTDr9sSE=; b=NtEvSlyazmVcX+uk5Su2fnPf9e4Bxtgqtn+awcWc/sy3vw08C4r6zMDInBcXHbvwSk wUWE+KEoMr//t97FekdLdb0Gb5soBkWmBo1sM+LMx4Du5PTpDhZypUHIrD2j//sH20IL lyimWZVXrVJAswWAGj9joEi6pQA65nNUEOR3VFNzYOCqLU89WW96OZBskwyN2+09/G0M Lnfc5FVxHpnG8Ed2K9L2Xhr6SWMPgW50iOcasB2dkD7auvnNn8irObtkpjlTw1tWwKNZ YTrT8M6xt8JAZiVvYjKYMWZVWrYp57FWcE41Xq05NFTi4ZaW2XBzq0fLdlunOH2u49mv jmeA== Received: by 10.50.217.227 with SMTP id pb3mr838163igc.28.1346387412530; Thu, 30 Aug 2012 21:30:12 -0700 (PDT) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.50.184.232 with SMTP id ex8csp44672igc; Thu, 30 Aug 2012 21:30:11 -0700 (PDT) Received: by 10.66.75.97 with SMTP id b1mr13381953paw.15.1346387411729; Thu, 30 Aug 2012 21:30:11 -0700 (PDT) Received: from mail-pb0-f50.google.com (mail-pb0-f50.google.com [209.85.160.50]) by mx.google.com with ESMTPS id pv1si6369841pbb.119.2012.08.30.21.30.11 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 30 Aug 2012 21:30:11 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.160.50 is neither permitted nor denied by best guess record for domain of tushar.behera@linaro.org) client-ip=209.85.160.50; Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.160.50 is neither permitted nor denied by best guess record for domain of tushar.behera@linaro.org) smtp.mail=tushar.behera@linaro.org Received: by mail-pb0-f50.google.com with SMTP id md12so4575654pbc.37 for ; Thu, 30 Aug 2012 21:30:11 -0700 (PDT) Received: by 10.66.78.73 with SMTP id z9mr13493451paw.9.1346387411344; Thu, 30 Aug 2012 21:30:11 -0700 (PDT) Received: from localhost.localdomain ([115.113.119.130]) by mx.google.com with ESMTPS id vh7sm2710447pbc.22.2012.08.30.21.30.08 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 30 Aug 2012 21:30:10 -0700 (PDT) From: Tushar Behera To: linaro-dev@lists.linaro.org Cc: john.stultz@linaro.org, jpa@google.com, patches@linaro.org Subject: [PATCH 1/2] netfilter: xt_quota2: Move away from NLMSG_PUT() Date: Fri, 31 Aug 2012 09:57:37 +0530 Message-Id: <1346387258-18321-2-git-send-email-tushar.behera@linaro.org> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1346387258-18321-1-git-send-email-tushar.behera@linaro.org> References: <1346387258-18321-1-git-send-email-tushar.behera@linaro.org> X-Gm-Message-State: ALoCoQkYsy1OQHXsERHdBhk9qYC6q8eUsOp6eOFFHAXmGoh1/DQMono7WI0sKW3PobKDYgrZWjeu Commit c3deafc5261a ("netlink: Delete NLMSG_PUT and NLMSG_NEW.") removes NLMSG_PUT() and recommends use of nlmsg_put() instead. Signed-off-by: Tushar Behera --- net/netfilter/xt_quota2.c | 17 +++++++++++------ 1 files changed, 11 insertions(+), 6 deletions(-) diff --git a/net/netfilter/xt_quota2.c b/net/netfilter/xt_quota2.c index fb2ef46..865f909 100644 --- a/net/netfilter/xt_quota2.c +++ b/net/netfilter/xt_quota2.c @@ -24,6 +24,8 @@ #include #endif +#include + /** * @lock: lock to protect quota writers from each other */ @@ -82,9 +84,15 @@ static void quota2_log(unsigned int hooknum, } /* NLMSG_PUT() uses "goto nlmsg_failure" */ - nlh = NLMSG_PUT(log_skb, /*pid*/0, /*seq*/0, qlog_nl_event, - sizeof(*pm)); - pm = NLMSG_DATA(nlh); + nlh = nlmsg_put(log_skb, /*pid*/0, /*seq*/0, qlog_nl_event, + sizeof(*pm), 0); + + if (!nlh) { + pr_debug("xt_quota2: error during NLMSG_PUT\n"); + return; + } + + pm = nlmsg_data(nlh); if (skb->tstamp.tv64 == 0) __net_timestamp((struct sk_buff *)skb); pm->data_len = 0; @@ -106,9 +114,6 @@ static void quota2_log(unsigned int hooknum, NETLINK_CB(log_skb).dst_group = 1; pr_debug("throwing 1 packets to netlink group 1\n"); netlink_broadcast(nflognl, log_skb, 0, 1, GFP_ATOMIC); - -nlmsg_failure: /* Used within NLMSG_PUT() */ - pr_debug("xt_quota2: error during NLMSG_PUT\n"); } #else static void quota2_log(unsigned int hooknum,