On Thu, Jul 28, 2022 at 11:14:35AM -0700, Boris Burkov wrote: > +static int process_enable_verity(const char *path, u8 algorithm, u32 block_size, > + int salt_len, char *salt, > + int sig_len, char *sig, void *user) > +{ > + int ret; > + struct btrfs_receive *rctx = user; > + char full_path[PATH_MAX]; > + struct fsverity_enable_arg verity_args = { > + .version = 1, > + .hash_algorithm = algorithm, > + .block_size = block_size, > + }; > + if (salt_len) { > + verity_args.salt_size = salt_len; > + verity_args.salt_ptr = (__u64)salt; > + } > + if (sig_len) { > + verity_args.sig_size = sig_len; > + verity_args.sig_ptr = (__u64)sig; > + } Casting a pointer to a __u64 needs to be done using (__u64)(uintptr_t), otherwise it will cause a warning on 32-bit platforms. > + /* > + * Enabling verity denies write access, so it cannot be done with an > + * open writeable file descriptor. > + */ > + close_inode_for_write(rctx); > + ret = ioctl(ioctl_fd, FS_IOC_ENABLE_VERITY, &verity_args); > + if (ret < 0) > + fprintf(stderr, "Failed to enable verity on %s: %d\n", full_path, ret); Errors from ioctl() are returned in errno, not in the return value. - Eric