acl: use uintptr_t for ace walker cookies

Avoid assuming that a pointer can fit in a uint64_t and use uintptr_t
instead.

Reviewed-by: Matthew Ahrens <mahrens@delphix.com>
Reviewed-by: Richard Yao <richard.yao@alumni.stonybrook.edu>
Signed-off-by: Brooks Davis <brooks.davis@sri.com>
Closes #14131
This commit is contained in:
Brooks Davis 2022-10-27 23:04:17 +01:00 committed by Brian Behlendorf
parent 7309e94239
commit d96303cb07
4 changed files with 11 additions and 11 deletions

View File

@ -47,7 +47,7 @@ extern int acltrivial(const char *);
extern void adjust_ace_pair(ace_t *pair, mode_t mode); extern void adjust_ace_pair(ace_t *pair, mode_t mode);
extern void adjust_ace_pair_common(void *, size_t, size_t, mode_t); extern void adjust_ace_pair_common(void *, size_t, size_t, mode_t);
extern int ace_trivial_common(void *, int, extern int ace_trivial_common(void *, int,
uint64_t (*walk)(void *, uint64_t, int aclcnt, uint16_t *, uint16_t *, uintptr_t (*walk)(void *, uintptr_t, int aclcnt, uint16_t *, uint16_t *,
uint32_t *mask)); uint32_t *mask));
#if !defined(_KERNEL) #if !defined(_KERNEL)
extern acl_t *acl_alloc(acl_type_t); extern acl_t *acl_alloc(acl_type_t);

View File

@ -1654,13 +1654,13 @@ acl_trivial_create(mode_t mode, boolean_t isdir, ace_t **acl, int *count)
*/ */
int int
ace_trivial_common(void *acep, int aclcnt, ace_trivial_common(void *acep, int aclcnt,
uint64_t (*walk)(void *, uint64_t, int aclcnt, uintptr_t (*walk)(void *, uintptr_t, int aclcnt,
uint16_t *, uint16_t *, uint32_t *)) uint16_t *, uint16_t *, uint32_t *))
{ {
uint16_t flags; uint16_t flags;
uint32_t mask; uint32_t mask;
uint16_t type; uint16_t type;
uint64_t cookie = 0; uintptr_t cookie = 0;
while ((cookie = walk(acep, cookie, aclcnt, &flags, &type, &mask))) { while ((cookie = walk(acep, cookie, aclcnt, &flags, &type, &mask))) {
switch (flags & ACE_TYPE_FLAGS) { switch (flags & ACE_TYPE_FLAGS) {

View File

@ -631,8 +631,8 @@ zfs_acl_next_ace(zfs_acl_t *aclp, void *start, uint64_t *who,
return (NULL); return (NULL);
} }
static uint64_t static uintptr_t
zfs_ace_walk(void *datap, uint64_t cookie, int aclcnt, zfs_ace_walk(void *datap, uintptr_t cookie, int aclcnt,
uint16_t *flags, uint16_t *type, uint32_t *mask) uint16_t *flags, uint16_t *type, uint32_t *mask)
{ {
(void) aclcnt; (void) aclcnt;
@ -642,7 +642,7 @@ zfs_ace_walk(void *datap, uint64_t cookie, int aclcnt,
acep = zfs_acl_next_ace(aclp, acep, &who, mask, acep = zfs_acl_next_ace(aclp, acep, &who, mask,
flags, type); flags, type);
return ((uint64_t)(uintptr_t)acep); return ((uintptr_t)acep);
} }
/* /*

View File

@ -629,18 +629,18 @@ zfs_acl_next_ace(zfs_acl_t *aclp, void *start, uint64_t *who,
return (NULL); return (NULL);
} }
static uint64_t static uintptr_t
zfs_ace_walk(void *datap, uint64_t cookie, int aclcnt, zfs_ace_walk(void *datap, uintptr_t cookie, int aclcnt,
uint16_t *flags, uint16_t *type, uint32_t *mask) uint16_t *flags, uint16_t *type, uint32_t *mask)
{ {
(void) aclcnt; (void) aclcnt;
zfs_acl_t *aclp = datap; zfs_acl_t *aclp = datap;
zfs_ace_hdr_t *acep = (zfs_ace_hdr_t *)(uintptr_t)cookie; zfs_ace_hdr_t *acep = (zfs_ace_hdr_t *)cookie;
uint64_t who; uint64_t who;
acep = zfs_acl_next_ace(aclp, acep, &who, mask, acep = zfs_acl_next_ace(aclp, acep, &who, mask,
flags, type); flags, type);
return ((uint64_t)(uintptr_t)acep); return ((uintptr_t)acep);
} }
/* /*
@ -1285,7 +1285,7 @@ acl_trivial_access_masks(mode_t mode, boolean_t isdir, trivial_acl_t *masks)
*/ */
static int static int
ace_trivial_common(void *acep, int aclcnt, ace_trivial_common(void *acep, int aclcnt,
uint64_t (*walk)(void *, uint64_t, int aclcnt, uintptr_t (*walk)(void *, uintptr_t, int,
uint16_t *, uint16_t *, uint32_t *)) uint16_t *, uint16_t *, uint32_t *))
{ {
uint16_t flags; uint16_t flags;