From patchwork Wed Jan 16 18:44:07 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ben Pfaff X-Patchwork-Id: 1026135 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=openvswitch.org (client-ip=140.211.169.12; helo=mail.linuxfoundation.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=ovn.org Received: from mail.linuxfoundation.org (mail.linuxfoundation.org [140.211.169.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 43fxdw1J3Sz9sD4 for ; Thu, 17 Jan 2019 06:11:48 +1100 (AEDT) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id 0C79B5173; Wed, 16 Jan 2019 19:10:22 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@mail.linuxfoundation.org Received: from smtp1.linuxfoundation.org (smtp1.linux-foundation.org [172.17.192.35]) by mail.linuxfoundation.org (Postfix) with ESMTPS id C4C0D47F9 for ; Wed, 16 Jan 2019 18:44:17 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from relay10.mail.gandi.net (relay10.mail.gandi.net [217.70.178.230]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id 3362C2C6 for ; Wed, 16 Jan 2019 18:44:16 +0000 (UTC) Received: from sigill.attlocal.net (75-54-222-30.lightspeed.rdcyca.sbcglobal.net [75.54.222.30]) (Authenticated sender: blp@ovn.org) by relay10.mail.gandi.net (Postfix) with ESMTPSA id 9FB4C240005; Wed, 16 Jan 2019 18:44:13 +0000 (UTC) From: Ben Pfaff To: dev@openvswitch.org Date: Wed, 16 Jan 2019 10:44:07 -0800 Message-Id: <20190116184407.3302-1-blp@ovn.org> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org Cc: Ben Pfaff Subject: [ovs-dev] [PATCH] ofpbuf: Reintroduce assertion on size in ofpbuf_pull(). X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: ovs-dev-bounces@openvswitch.org Errors-To: ovs-dev-bounces@openvswitch.org This assertion was removed as part of a commit that was intended to just be a cleanup. Fixes: 6fd6ed71cb9f ("ofpbuf: Simplify ofpbuf API.") Signed-off-by: Ben Pfaff Acked-by: Justin Pettit --- include/openvswitch/ofpbuf.h | 1 + 1 file changed, 1 insertion(+) diff --git a/include/openvswitch/ofpbuf.h b/include/openvswitch/ofpbuf.h index dffd78414ced..71ee0c9534a3 100644 --- a/include/openvswitch/ofpbuf.h +++ b/include/openvswitch/ofpbuf.h @@ -246,6 +246,7 @@ static inline void ofpbuf_clear(struct ofpbuf *b) * 'size' bytes of data. Returns the first byte of data removed. */ static inline void *ofpbuf_pull(struct ofpbuf *b, size_t size) { + ovs_assert(b->size >= size); void *data = b->data; b->data = (char*)b->data + size; b->size = b->size - size;