From 2f7e13206d8a2a347bc8f2beb8d8ac95669a6618 Mon Sep 17 00:00:00 2001 From: Lukas Slebodnik Date: Feb 09 2019 21:22:54 +0000 Subject: cifs_idmap: Fix warning address-of-packed-member Packed attribute on a structure implies the alignment of the structure is 1 byte. And uint32_t/uid_t is usually aligned to 4 bytes. CC src/lib/cifs_idmap_sss/cifs_idmap_sss_la-cifs_idmap_sss.lo src/lib/cifs_idmap_sss/cifs_idmap_sss.c: In function ‘sss_sid_to_id’: src/lib/cifs_idmap_sss/cifs_idmap_sss.c:221:47: error: taking address of packed member of ‘struct cifs_uxid’ may result in an unaligned pointer value [-Werror=address-of-packed-member] 221 | err = sss_nss_getidbysid(sid, (uint32_t *)&cuxid->id.uid, &id_type); | Merges: https://pagure.io/SSSD/sssd/pull-request/3950 --- diff --git a/src/lib/cifs_idmap_sss/cifs_idmap_sss.c b/src/lib/cifs_idmap_sss/cifs_idmap_sss.c index e7a0b83..4620ea9 100644 --- a/src/lib/cifs_idmap_sss/cifs_idmap_sss.c +++ b/src/lib/cifs_idmap_sss/cifs_idmap_sss.c @@ -217,12 +217,14 @@ static int sss_sid_to_id(struct sssd_ctx *ctx, const char *sid, { int err; enum sss_id_type id_type; + uid_t temp; - err = sss_nss_getidbysid(sid, (uint32_t *)&cuxid->id.uid, &id_type); + err = sss_nss_getidbysid(sid, &temp, &id_type); if (err != 0) { ctx_set_error(ctx, strerror(err)); return -1; } + cuxid->id.uid = temp; switch (id_type) { case SSS_ID_TYPE_UID: