#3950 cifs_idmap: Fix warning address-of-packed-member
Closed 5 years ago by lslebodn. Opened 5 years ago by lslebodn.
SSSD/ lslebodn/sssd Waddress-of-packed-member  into  master

@@ -217,12 +217,14 @@ 

  {

      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:

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);
|

rebased onto 2f7e132

5 years ago

Pull-Request has been closed by lslebodn

5 years ago
Metadata