Re: [PATCH spice-server 2/2] dcc: Avoid usage of not aligned GlzEncDictRestoreData structure

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 5/8/19 4:06 PM, Frediano Ziglio wrote:
Copy to/from unaligned field to avoid potential unaligned access.
Although it adds a copy it's not in a hot path (migration) and
the structure is pretty small.

Signed-off-by: Frediano Ziglio <fziglio@xxxxxxxxxx>

Ack, but see one comment below.

I wrote a similar patch, you sent it faster :)

---
  server/dcc-send.c | 4 +++-
  server/dcc.c      | 3 ++-
  2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/server/dcc-send.c b/server/dcc-send.c
index e9b01b38..9fc54046 100644
--- a/server/dcc-send.c
+++ b/server/dcc-send.c
@@ -1845,8 +1845,10 @@ static void display_channel_marshall_migrate_data(RedChannelClient *rcc,
      memcpy(display_data.pixmap_cache_clients, dcc->priv->pixmap_cache->sync,
             sizeof(display_data.pixmap_cache_clients));
+ GlzEncDictRestoreData glz_dict_data;

Perhaps move it to the beginning of the function like all the
other local variables.

Uri.

      image_encoders_glz_get_restore_data(encoders, &display_data.glz_dict_id,
-                                        &display_data.glz_dict_data);
+                                        &glz_dict_data);
+    display_data.glz_dict_data = glz_dict_data;
/* all data besided the surfaces ref */
      spice_marshaller_add(base_marshaller,
diff --git a/server/dcc.c b/server/dcc.c
index fdb0fbf1..271a466b 100644
--- a/server/dcc.c
+++ b/server/dcc.c
@@ -1251,10 +1251,11 @@ bool dcc_handle_message(RedChannelClient *rcc, uint16_t type, uint32_t size, voi
  static int dcc_handle_migrate_glz_dictionary(DisplayChannelClient *dcc,
                                               SpiceMigrateDataDisplay *migrate)
  {
+    GlzEncDictRestoreData glz_dict_data = migrate->glz_dict_data;
      return image_encoders_restore_glz_dictionary(&dcc->priv->encoders,
                                                   red_channel_client_get_client(RED_CHANNEL_CLIENT(dcc)),
                                                   migrate->glz_dict_id,
-                                                 &migrate->glz_dict_data);
+                                                 &glz_dict_data);
  }
static bool restore_surface(DisplayChannelClient *dcc, uint32_t surface_id)


_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/spice-devel




[Index of Archives]     [Linux Virtualization]     [Linux Virtualization]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]