From mboxrd@z Thu Jan 1 00:00:00 1970 From: Paolo Bonzini Subject: Re: [PATCH v3 2/4] KVM: x86: Use vector-hashing to deliver lowest-priority interrupts Date: Mon, 25 Jan 2016 17:14:50 +0100 Message-ID: <56A649FA.7010209@redhat.com> References: <1453254177-103002-1-git-send-email-feng.wu@intel.com> <1453254177-103002-3-git-send-email-feng.wu@intel.com> <20160121194950.GC17514@potion.brq.redhat.com> <20160122140154.GD14104@potion.brq.redhat.com> <56A61432.3010500@redhat.com> <20160125152040.GC21252@potion.brq.redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: QUOTED-PRINTABLE Cc: "Wu, Feng" , "linux-kernel@vger.kernel.org" , "kvm@vger.kernel.org" To: =?UTF-8?Q?Radim_Krcm=c3=a1r?= Return-path: In-Reply-To: <20160125152040.GC21252@potion.brq.redhat.com> Sender: linux-kernel-owner@vger.kernel.org List-Id: kvm.vger.kernel.org On 25/01/2016 16:20, Radim Krcm=C3=A1r wrote: > 2016-01-25 13:25+0100, Paolo Bonzini: >> On 22/01/2016 15:01, Radim Krcm=C3=A1r wrote: >>>> for (i =3D 0; i <=3D mod; i++) { >>>> idx =3D find_next_bit(bitmap, bitmap_size, idx + 1= ); >>>> BUG_ON(idx =3D=3D bitmap_size); >>>> } >> >> WARN_ON, not BUG_ON. >=20 > Callers don't check the return value for an error, because every erro= r > is a BUG now. I think that we should check if we return bitmap_size. > (Current paths could dereference NULL or throw unrelated warnings.) You can probably just return a random number (e.g. zero or find_first_bit) if the bug is hit. But really, the bug is easy enough to verify that BUG_ON might even be okay... Paolo