Blame SOURCES/kvm-slirp-reformat-m_inc-routine.patch

357786
From 37e3851f6eac7999e7c5a7cfd41d53f72e47b03d Mon Sep 17 00:00:00 2001
44d016
From: Xiao Wang <jasowang@redhat.com>
357786
Date: Wed, 8 Aug 2018 07:52:56 +0200
357786
Subject: [PATCH 1/5] slirp: reformat m_inc routine
44d016
44d016
RH-Author: Xiao Wang <jasowang@redhat.com>
357786
Message-id: <1533714777-24827-2-git-send-email-jasowang@redhat.com>
357786
Patchwork-id: 81675
357786
O-Subject: [RHEL-7.6/7.5z qemu-kvm-rhev 1/2] slirp: reformat m_inc routine
357786
Bugzilla: 1586255
44d016
RH-Acked-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
44d016
RH-Acked-by: wexu@redhat.com
44d016
RH-Acked-by: Thomas Huth <thuth@redhat.com>
44d016
44d016
From: Prasad J Pandit <pjp@fedoraproject.org>
44d016
44d016
Coding style changes to the m_inc routine and minor refactoring.
44d016
44d016
Reported-by: ZDI Disclosures <zdi-disclosures@trendmicro.com>
44d016
Signed-off-by: Prasad J Pandit <pjp@fedoraproject.org>
44d016
Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
44d016
(cherry picked from commit c22098c74a09164797fae6511c5eaf68f32c4dd8)
44d016
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
44d016
---
44d016
 slirp/mbuf.c | 34 ++++++++++++++++------------------
44d016
 1 file changed, 16 insertions(+), 18 deletions(-)
44d016
44d016
diff --git a/slirp/mbuf.c b/slirp/mbuf.c
44d016
index 18cbf75..0c189e1 100644
44d016
--- a/slirp/mbuf.c
44d016
+++ b/slirp/mbuf.c
44d016
@@ -151,27 +151,25 @@ m_cat(struct mbuf *m, struct mbuf *n)
44d016
 void
44d016
 m_inc(struct mbuf *m, int size)
44d016
 {
44d016
-	int datasize;
44d016
+    int datasize;
44d016
 
44d016
-	/* some compiles throw up on gotos.  This one we can fake. */
44d016
-        if(m->m_size>size) return;
44d016
+    /* some compilers throw up on gotos.  This one we can fake. */
44d016
+    if (m->m_size > size) {
44d016
+        return;
44d016
+    }
44d016
 
44d016
-        if (m->m_flags & M_EXT) {
44d016
-	  datasize = m->m_data - m->m_ext;
44d016
-	  m->m_ext = g_realloc(m->m_ext, size + datasize);
44d016
-	  m->m_data = m->m_ext + datasize;
44d016
-        } else {
44d016
-	  char *dat;
44d016
-	  datasize = m->m_data - m->m_dat;
44d016
-	  dat = g_malloc(size + datasize);
44d016
-	  memcpy(dat, m->m_dat, m->m_size);
44d016
-
44d016
-	  m->m_ext = dat;
44d016
-	  m->m_data = m->m_ext + datasize;
44d016
-	  m->m_flags |= M_EXT;
44d016
-        }
44d016
+    if (m->m_flags & M_EXT) {
44d016
+        datasize = m->m_data - m->m_ext;
44d016
+        m->m_ext = g_realloc(m->m_ext, size + datasize);
44d016
+    } else {
44d016
+        datasize = m->m_data - m->m_dat;
44d016
+        m->m_ext = g_malloc(size + datasize);
44d016
+        memcpy(m->m_ext, m->m_dat, m->m_size);
44d016
+        m->m_flags |= M_EXT;
44d016
+    }
44d016
 
44d016
-        m->m_size = size + datasize;
44d016
+    m->m_data = m->m_ext + datasize;
44d016
+    m->m_size = size + datasize;
44d016
 }
44d016
 
44d016
 
44d016
-- 
44d016
1.8.3.1
44d016