From dc6035345515acb39bf5f9bc2e5104ad0e10cc2c Mon Sep 17 00:00:00 2001 From: Alexander Bokovoy <ab@samba.org> Date: Wed, 16 Feb 2022 14:18:16 +0200 Subject: fix warnings for -Waddress-of-packed-member When structure members are packed, GCC will issue a warning that taking an address of the packed structure member might cause an unaligned access. In all cases where this happen we simply can use a local variable instead and then assign the result in a proper way. Signed-off-by: Alexander Bokovoy <ab@samba.org> --- cifs.idmap.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'cifs.idmap.c') diff --git a/cifs.idmap.c b/cifs.idmap.c index cbc01c5..d557edb 100644 --- a/cifs.idmap.c +++ b/cifs.idmap.c @@ -172,12 +172,14 @@ cifs_idmap(const key_serial_t key, const char *key_descr) sidstr = strget(key_descr, "oi:"); if (sidstr) { - rc = str_to_uint(sidstr, (unsigned int *)&cuxid.id.uid); + unsigned int _uid = 0; + rc = str_to_uint(sidstr, (unsigned int *)&_uid); if (rc) { syslog(LOG_ERR, "Unable to convert %s to uid: %s", sidstr, strerror(rc)); goto cifs_idmap_ret; } + cuxid.id.uid = _uid; cuxid.type = CIFS_UXID_TYPE_UID; syslog(LOG_DEBUG, "SID: %s, uid: %u", sidstr, cuxid.id.uid); @@ -198,12 +200,14 @@ cifs_idmap(const key_serial_t key, const char *key_descr) sidstr = strget(key_descr, "gi:"); if (sidstr) { - rc = str_to_uint(sidstr, (unsigned int *)&cuxid.id.gid); + unsigned int _gid = 0; + rc = str_to_uint(sidstr, (unsigned int *)&_gid); if (rc) { syslog(LOG_ERR, "Unable to convert %s to gid: %s", sidstr, strerror(rc)); goto cifs_idmap_ret; } + cuxid.id.gid = _gid; cuxid.type = CIFS_UXID_TYPE_GID; syslog(LOG_DEBUG, "SID: %s, gid: %u", sidstr, cuxid.id.gid); -- cgit v1.2.3