diff mbox series

[ovs-dev] ofpbuf: Reintroduce assertion on size in ofpbuf_pull().

Message ID 20190116184407.3302-1-blp@ovn.org
State Accepted
Headers show
Series [ovs-dev] ofpbuf: Reintroduce assertion on size in ofpbuf_pull(). | expand

Commit Message

Ben Pfaff Jan. 16, 2019, 6:44 p.m. UTC
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 <blp@ovn.org>
---
 include/openvswitch/ofpbuf.h | 1 +
 1 file changed, 1 insertion(+)

Comments

Justin Pettit Jan. 17, 2019, 6:08 p.m. UTC | #1
> On Jan 16, 2019, at 10:44 AM, Ben Pfaff <blp@ovn.org> wrote:
> 
> 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 <blp@ovn.org>

Acked-by: Justin Pettit <jpettit@ovn.org>

--Justin
Ben Pfaff Jan. 18, 2019, 12:52 a.m. UTC | #2
On Thu, Jan 17, 2019 at 10:08:48AM -0800, Justin Pettit wrote:
> 
> 
> > On Jan 16, 2019, at 10:44 AM, Ben Pfaff <blp@ovn.org> wrote:
> > 
> > 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 <blp@ovn.org>
> 
> Acked-by: Justin Pettit <jpettit@ovn.org>

Thanks!  Applied to master.
diff mbox series

Patch

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;