From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751503AbdIJLYe (ORCPT ); Sun, 10 Sep 2017 07:24:34 -0400 Received: from Chamillionaire.breakpoint.cc ([146.0.238.67]:49598 "EHLO Chamillionaire.breakpoint.cc" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750782AbdIJLYd (ORCPT ); Sun, 10 Sep 2017 07:24:33 -0400 Date: Sun, 10 Sep 2017 13:21:26 +0200 From: Florian Westphal To: Geert Uytterhoeven Cc: Florian Westphal , Pablo Neira Ayuso , Linux Kernel Mailing List , "netdev@vger.kernel.org" , "David S. Miller" , Arnd Bergmann Subject: Re: Division by zero on UP (was: Re: netfilter: nat: use keyed locks) Message-ID: <20170910112126.GB25977@breakpoint.cc> References: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Geert Uytterhoeven wrote: > > srchash = hash_by_src(net, > > &ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple); > > - spin_lock_bh(&nf_nat_lock); > > + lock = &nf_nat_locks[srchash % ARRAY_SIZE(nf_nat_locks)]; > > + spin_lock_bh(lock); > > If no spinlock debugging options (CONFIG_GENERIC_LOCKBREAK, > CONFIG_DEBUG_SPINLOCK, CONFIG_DEBUG_LOCK_ALLOC) are enabled on a UP platform > (e.g. m68k defconfig), arch_spinlock_t is an empty struct, and thus > ARRAY_SIZE(nf_nat_locks)] is zero, leading to: > > net/netfilter/nf_nat_core.c: In function ‘nf_nat_setup_info’: > net/netfilter/nf_nat_core.c:432: warning: division by zero Gah. Sorry. This is the 2nd time I add such a bug :( Can you send a patch? It should be enough to use CONNTRACK_LOCKS instead of ARRAY_SIZE(nf_nat_locks) to avoid this problem. Otherwise I will take care of this next thing monday morning.