From patchwork Tue Feb 24 16:10:57 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Josh Hunt X-Patchwork-Id: 443040 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 4E04D14016B for ; Wed, 25 Feb 2015 03:11:15 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752792AbbBXQLF (ORCPT ); Tue, 24 Feb 2015 11:11:05 -0500 Received: from prod-mail-xrelay08.akamai.com ([96.6.114.112]:46259 "EHLO prod-mail-xrelay08.akamai.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752447AbbBXQLC (ORCPT ); Tue, 24 Feb 2015 11:11:02 -0500 Received: from prod-mail-xrelay08.akamai.com (localhost.localdomain [127.0.0.1]) by postfix.imss70 (Postfix) with ESMTP id 4E996487A4; Tue, 24 Feb 2015 16:11:01 +0000 (GMT) Received: from prod-mail-relay08.akamai.com (prod-mail-relay08.akamai.com [172.27.22.71]) by prod-mail-xrelay08.akamai.com (Postfix) with ESMTP id 42B644879C; Tue, 24 Feb 2015 16:11:01 +0000 (GMT) Received: from sfo-lv5r2.sanmateo.corp.akamai.com (sfo-lv5r2.sanmateo.corp.akamai.com [172.28.156.58]) by prod-mail-relay08.akamai.com (Postfix) with ESMTP id 250D898098; Tue, 24 Feb 2015 16:11:01 +0000 (GMT) Received: from johunt by sfo-lv5r2.sanmateo.corp.akamai.com with local (Exim 4.76) (envelope-from ) id 1YQI4a-0007sT-Up; Tue, 24 Feb 2015 11:11:00 -0500 From: Josh Hunt To: Pablo Neira Ayuso , Patrick McHardy , Thomas Graf Cc: netfilter-devel@vger.kernel.org, netdev@vger.kernel.org, Daniel Borkmann , Josh Hunt Subject: [PATCH v2 1/2] rhashtable: require max_shift if grow_decision defined Date: Tue, 24 Feb 2015 11:10:57 -0500 Message-Id: <1424794259-30241-2-git-send-email-johunt@akamai.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1424794259-30241-1-git-send-email-johunt@akamai.com> References: <1424794259-30241-1-git-send-email-johunt@akamai.com> Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org If an rhashtable user defines a grow_decision fn they must also define a max_shift parameter. Signed-off-by: Josh Hunt Acked-by: Thomas Graf --- lib/rhashtable.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/rhashtable.c b/lib/rhashtable.c index 9cc4c4a..7d6f539 100644 --- a/lib/rhashtable.c +++ b/lib/rhashtable.c @@ -1077,7 +1077,8 @@ int rhashtable_init(struct rhashtable *ht, struct rhashtable_params *params) size = HASH_DEFAULT_SIZE; if ((params->key_len && !params->hashfn) || - (!params->key_len && !params->obj_hashfn)) + (!params->key_len && !params->obj_hashfn) || + (params->grow_decision && !params->max_shift)) return -EINVAL; if (params->nulls_base && params->nulls_base < (1U << RHT_BASE_SHIFT))