diff mbox

[09/12] btrfs-progs: don't deref pipefd[-1]

Message ID 1381182185-10896-10-git-send-email-zab@redhat.com (mailing list archive)
State Accepted, archived
Headers show

Commit Message

Zach Brown Oct. 7, 2013, 9:43 p.m. UTC
commit 4782e8ebdb583dfa3615f7b38dee729d34f62ec1 accidentally replaced
[0] with [-1].  Put it back.  This was found by static analysis.

Signed-off-by: Zach Brown <zab@redhat.com>
---
 send-test.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Eric Sandeen Oct. 7, 2013, 9:45 p.m. UTC | #1
On 10/7/13 4:43 PM, Zach Brown wrote:
> commit 4782e8ebdb583dfa3615f7b38dee729d34f62ec1 accidentally replaced
> [0] with [-1].  Put it back.  This was found by static analysis.
> 
> Signed-off-by: Zach Brown <zab@redhat.com>

eeehhhyeah.  Thanks for being charitable. ;)

Really, I have no idea how that happened.

Reviewed-by: Eric Sandeen <sandeen@redhat.com>

> ---
>  send-test.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/send-test.c b/send-test.c
> index 3775f5f..a37b7fd 100644
> --- a/send-test.c
> +++ b/send-test.c
> @@ -354,7 +354,7 @@ static void *process_thread(void *arg_)
>  	int ret;
>  
>  	while (1) {
> -		ret = btrfs_read_and_process_send_stream(pipefd[-1],
> +		ret = btrfs_read_and_process_send_stream(pipefd[0],
>  							 &send_ops_print, arg_, 0);
>  		if (ret)
>  			break;
> 

--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Zach Brown Oct. 7, 2013, 9:47 p.m. UTC | #2
On Mon, Oct 07, 2013 at 04:45:01PM -0500, Eric Sandeen wrote:
> On 10/7/13 4:43 PM, Zach Brown wrote:
> > commit 4782e8ebdb583dfa3615f7b38dee729d34f62ec1 accidentally replaced
> > [0] with [-1].  Put it back.  This was found by static analysis.
> > 
> > Signed-off-by: Zach Brown <zab@redhat.com>
> 
> eeehhhyeah.  Thanks for being charitable. ;)
> 
> Really, I have no idea how that happened.

I couldn't figure it out either.  The best I could come up with is that
one of the local XFS guys climbed in your office window and made the
change while you were at lunch.  In a black leotard with an awesome mask
and a black sack over their shoulder.

- z
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/send-test.c b/send-test.c
index 3775f5f..a37b7fd 100644
--- a/send-test.c
+++ b/send-test.c
@@ -354,7 +354,7 @@  static void *process_thread(void *arg_)
 	int ret;
 
 	while (1) {
-		ret = btrfs_read_and_process_send_stream(pipefd[-1],
+		ret = btrfs_read_and_process_send_stream(pipefd[0],
 							 &send_ops_print, arg_, 0);
 		if (ret)
 			break;