Message ID | 20201209210955.hcgai4ougmjeiwys@fiona (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | btrfs-progs: Fix buffer pointer while reading exclusive_operation | expand |
On 9.12.20 г. 23:09 ч., Goldwyn Rodrigues wrote: > While performing the sysfs read for the exclusive_operation, the buffer > pointer is incorrectly subtracted. This reads the file incorrectly and hence > BTRFS_EXCLOP_UNKNOWN is passed everytime the function is called. > > Fixes: 1abf37eb btrfs-progs: add helpers for parsing filesystem exclusive operation > Signed-off-by: Goldwyn Rodrigues <rgoldwyn@suse.com> Reviewed-by: Nikolay Borisov <nborisov@suse.com> > > diff --git a/common/utils.c b/common/utils.c > index 3dc1fdc1..ff29cb81 100644 > --- a/common/utils.c > +++ b/common/utils.c > @@ -1952,7 +1952,7 @@ int get_fs_exclop(int fd) > return BTRFS_EXCLOP_UNKNOWN; > > memset(buf, 0, sizeof(buf)); > - ret = sysfs_read_file(sysfs_fd, buf - 1, sizeof(buf)); > + ret = sysfs_read_file(sysfs_fd, buf, sizeof(buf)); > close(sysfs_fd); > if (ret <= 0) > return BTRFS_EXCLOP_UNKNOWN; >
diff --git a/common/utils.c b/common/utils.c index 3dc1fdc1..ff29cb81 100644 --- a/common/utils.c +++ b/common/utils.c @@ -1952,7 +1952,7 @@ int get_fs_exclop(int fd) return BTRFS_EXCLOP_UNKNOWN; memset(buf, 0, sizeof(buf)); - ret = sysfs_read_file(sysfs_fd, buf - 1, sizeof(buf)); + ret = sysfs_read_file(sysfs_fd, buf, sizeof(buf)); close(sysfs_fd); if (ret <= 0) return BTRFS_EXCLOP_UNKNOWN;
While performing the sysfs read for the exclusive_operation, the buffer pointer is incorrectly subtracted. This reads the file incorrectly and hence BTRFS_EXCLOP_UNKNOWN is passed everytime the function is called. Fixes: 1abf37eb btrfs-progs: add helpers for parsing filesystem exclusive operation Signed-off-by: Goldwyn Rodrigues <rgoldwyn@suse.com>