From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40673) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ypy7D-0005mD-9d for qemu-devel@nongnu.org; Wed, 06 May 2015 08:07:57 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Ypy77-00024k-Co for qemu-devel@nongnu.org; Wed, 06 May 2015 08:07:51 -0400 Received: from e06smtp14.uk.ibm.com ([195.75.94.110]:49159) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ypy77-00024d-3G for qemu-devel@nongnu.org; Wed, 06 May 2015 08:07:45 -0400 Received: from /spool/local by e06smtp14.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 6 May 2015 13:07:44 +0100 Received: from b06cxnps4075.portsmouth.uk.ibm.com (d06relay12.portsmouth.uk.ibm.com [9.149.109.197]) by d06dlp01.portsmouth.uk.ibm.com (Postfix) with ESMTP id 705D217D805A for ; Wed, 6 May 2015 13:08:27 +0100 (BST) Received: from d06av04.portsmouth.uk.ibm.com (d06av04.portsmouth.uk.ibm.com [9.149.37.216]) by b06cxnps4075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id t46C7g9G4522308 for ; Wed, 6 May 2015 12:07:42 GMT Received: from d06av04.portsmouth.uk.ibm.com (localhost [127.0.0.1]) by d06av04.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id t46C7ebp015243 for ; Wed, 6 May 2015 06:07:41 -0600 From: Greg Kurz Date: Wed, 06 May 2015 14:07:37 +0200 Message-ID: <20150506120737.8607.30158.stgit@bahia.huguette.org> In-Reply-To: <20150506120729.8607.23404.stgit@bahia.huguette.org> References: <20150506120729.8607.23404.stgit@bahia.huguette.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Subject: [Qemu-devel] [PATCH RFC 1/7] virtio: relax feature check List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Jason Wang , Stefan Hajnoczi , "Michael S. Tsirkin" Cc: qemu-devel@nongnu.org, virtualization@lists.linux-foundation.org Unlike with add and clear, there is no valid reason to abort when checking for a feature. It makes more sense to return false (i.e. the feature bit isn't set). This is exactly what __virtio_has_feature() does if fbit >= 32. This allows to introduce code that is aware about new 64-bit features like VIRTIO_F_VERSION_1, even if they are still not implemented. Signed-off-by: Greg Kurz --- include/hw/virtio/virtio.h | 1 - 1 file changed, 1 deletion(-) diff --git a/include/hw/virtio/virtio.h b/include/hw/virtio/virtio.h index d95f8b6..6ef70f1 100644 --- a/include/hw/virtio/virtio.h +++ b/include/hw/virtio/virtio.h @@ -233,7 +233,6 @@ static inline void virtio_clear_feature(uint32_t *features, unsigned int fbit) static inline bool __virtio_has_feature(uint32_t features, unsigned int fbit) { - assert(fbit < 32); return !!(features & (1 << fbit)); }