From patchwork Sun Oct 23 20:37:49 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jozsef Kadlecsik X-Patchwork-Id: 685592 X-Patchwork-Delegate: pablo@netfilter.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 3t2B825bDkz9t87 for ; Mon, 24 Oct 2016 07:38:26 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=blackhole.kfki.hu header.i=@blackhole.kfki.hu header.b=YjG4tFgf; dkim-atps=neutral Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756817AbcJWUiZ (ORCPT ); Sun, 23 Oct 2016 16:38:25 -0400 Received: from smtp-in.kfki.hu ([148.6.0.28]:50909 "EHLO smtp2.kfki.hu" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756778AbcJWUiH (ORCPT ); Sun, 23 Oct 2016 16:38:07 -0400 Received: from localhost (localhost [127.0.0.1]) by smtp2.kfki.hu (Postfix) with ESMTP id 42455CC012F; Sun, 23 Oct 2016 22:38:05 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= blackhole.kfki.hu; h=references:in-reply-to:x-mailer:message-id :date:date:from:from:received:received:received; s=20151130; t= 1477255083; x=1479069484; bh=YBrucqwtmecYRtLcT+0oDJyApTSgx28qwB5 vm/p1K1U=; b=YjG4tFgfhke3OOnBr5/Tqk/xFvEInkjB0TrZivvE0tvvfrxZ12x 7C7pqCjgbFKUxcbcQQmuy+Xh7L3WJCMmbMqS/L/c9clm1hySIaEKuJwVyTr9OSDv lG3Bg76nxiZOpBbVwHFWFVT9DjhB1oIyeuXGYJ9C8vw7VJR1U7QvV7ZM= X-Virus-Scanned: Debian amavisd-new at smtp2.kfki.hu Received: from smtp2.kfki.hu ([127.0.0.1]) by localhost (smtp2.kfki.hu [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id fZ8kdsT6qbEe; Sun, 23 Oct 2016 22:38:03 +0200 (CEST) Received: from blackhole.kfki.hu (blackhole.kfki.hu [IPv6:2001:738:5001::114]) by smtp2.kfki.hu (Postfix) with ESMTP id 36CCECC0135; Sun, 23 Oct 2016 22:37:57 +0200 (CEST) Received: by blackhole.kfki.hu (Postfix, from userid 1000) id 1EECE209B1; Sun, 23 Oct 2016 22:37:57 +0200 (CEST) From: Jozsef Kadlecsik To: netfilter-devel@vger.kernel.org Cc: Pablo Neira Ayuso Subject: [PATCH 16/22] netfilter: ipset: Collapse same condition body to a single one Date: Sun, 23 Oct 2016 22:37:49 +0200 Message-Id: <1477255075-15255-17-git-send-email-kadlec@blackhole.kfki.hu> X-Mailer: git-send-email 1.8.5.1 In-Reply-To: <1477255075-15255-1-git-send-email-kadlec@blackhole.kfki.hu> References: <1477255075-15255-1-git-send-email-kadlec@blackhole.kfki.hu> Sender: netfilter-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netfilter-devel@vger.kernel.org Signed-off-by: Jozsef Kadlecsik --- net/netfilter/ipset/ip_set_hash_gen.h | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/net/netfilter/ipset/ip_set_hash_gen.h b/net/netfilter/ipset/ip_set_hash_gen.h index 0082ccf..f4b30b6 100644 --- a/net/netfilter/ipset/ip_set_hash_gen.h +++ b/net/netfilter/ipset/ip_set_hash_gen.h @@ -721,14 +721,8 @@ struct htype { key = HKEY(value, h->initval, t->htable_bits); n = __ipset_dereference_protected(hbucket(t, key), 1); if (!n) { - if (forceadd) { - if (net_ratelimit()) - pr_warn("Set %s is full, maxelem %u reached\n", - set->name, h->maxelem); - return -IPSET_ERR_HASH_FULL; - } else if (set->elements >= h->maxelem) { + if (forceadd || set->elements >= h->maxelem) goto set_full; - } old = NULL; n = kzalloc(sizeof(*n) + AHASH_INIT_SIZE * set->dsize, GFP_ATOMIC);