diff options
author | Alexander Bokovoy <ab@samba.org> | 2022-02-16 14:18:16 +0200 |
---|---|---|
committer | Pavel Shilovsky <pshilovsky@samba.org> | 2022-04-29 15:07:49 -0700 |
commit | dc6035345515acb39bf5f9bc2e5104ad0e10cc2c (patch) | |
tree | 59b214772327f755eb31eb92ad83c2e0b69db674 | |
parent | c4c94ada3fecc28b53b84d51157bc37fb00236da (diff) | |
download | cifs-utils-dc6035345515acb39bf5f9bc2e5104ad0e10cc2c.tar.gz cifs-utils-dc6035345515acb39bf5f9bc2e5104ad0e10cc2c.tar.bz2 cifs-utils-dc6035345515acb39bf5f9bc2e5104ad0e10cc2c.zip |
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>
-rw-r--r-- | cifs.idmap.c | 8 | ||||
-rw-r--r-- | setcifsacl.c | 5 |
2 files changed, 10 insertions, 3 deletions
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); diff --git a/setcifsacl.c b/setcifsacl.c index 7ede417..d832cec 100644 --- a/setcifsacl.c +++ b/setcifsacl.c @@ -1111,6 +1111,7 @@ build_cmdline_aces(char **arrptr, int numcaces, ace_kinds ace_kind) int i; char *acesid, *acetype, *aceflag, *acemask; struct cifs_ace **cacesptr; + uint32_t access_req = 0; cacesptr = calloc(numcaces, sizeof(struct cifs_ace *)); if (!cacesptr) { @@ -1156,12 +1157,14 @@ build_cmdline_aces(char **arrptr, int numcaces, ace_kinds ace_kind) goto build_cmdline_aces_ret; } - if (verify_ace_mask(acemask, &cacesptr[i]->access_req)) { + if (verify_ace_mask(acemask, &access_req)) { fprintf(stderr, "%s: Invalid ACE mask: %s\n", __func__, arrptr[i]); goto build_cmdline_aces_ret; } + cacesptr[i]->access_req = access_req; + cacesptr[i]->size = htole16(1 + 1 + 2 + 4 + 1 + 1 + 6 + cacesptr[i]->sid.num_subauth * 4); } |