All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] btrfs-progs: Fix buffer pointer while reading exclusive_operation
@ 2020-12-09 21:09 Goldwyn Rodrigues
  2020-12-10  8:57 ` Nikolay Borisov
  0 siblings, 1 reply; 2+ messages in thread
From: Goldwyn Rodrigues @ 2020-12-09 21:09 UTC (permalink / raw)
  To: linux-btrfs; +Cc: dsterba

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>

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;

-- 
Goldwyn

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] btrfs-progs: Fix buffer pointer while reading exclusive_operation
  2020-12-09 21:09 [PATCH] btrfs-progs: Fix buffer pointer while reading exclusive_operation Goldwyn Rodrigues
@ 2020-12-10  8:57 ` Nikolay Borisov
  0 siblings, 0 replies; 2+ messages in thread
From: Nikolay Borisov @ 2020-12-10  8:57 UTC (permalink / raw)
  To: Goldwyn Rodrigues, linux-btrfs; +Cc: dsterba



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;
> 

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-12-10 11:45 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-09 21:09 [PATCH] btrfs-progs: Fix buffer pointer while reading exclusive_operation Goldwyn Rodrigues
2020-12-10  8:57 ` Nikolay Borisov

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.