public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] unlz4: always set an error return code on failures
@ 2013-11-08  9:27 Jan Beulich
  2013-11-11  2:49 ` Kyungsik Lee
  0 siblings, 1 reply; 5+ messages in thread
From: Jan Beulich @ 2013-11-08  9:27 UTC (permalink / raw)
  To: linux-kernel; +Cc: Matthew Daley, kyungsik.lee, akpm

"ret", being set to -1 early on, gets cleared by the first invocation
of lz4_decompress()/lz4_decompress_unknownoutputsize(), and hence
subsequent failures wouldn't be noticed by the caller without setting
it back to -1 right after those calls.

Reported-by: Matthew Daley <mattjd@gmail.com>
Signed-off-by: Jan Beulich <jbeulich@suse.com>
Cc: Kyungsik Lee <kyungsik.lee@lge.com>
Cc: Andrew Morton <akpm@linux-foundation.org>

--- a/lib/decompress_unlz4.c
+++ b/lib/decompress_unlz4.c
@@ -141,6 +141,7 @@ STATIC inline int INIT unlz4(u8 *input, 
 			goto exit_2;
 		}
 
+		ret = -1;
 		if (flush && flush(outp, dest_len) != dest_len)
 			goto exit_2;
 		if (output)




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

* Re: [PATCH] unlz4: always set an error return code on failures
  2013-11-08  9:27 [PATCH] unlz4: always set an error return code on failures Jan Beulich
@ 2013-11-11  2:49 ` Kyungsik Lee
  2013-11-11  8:35   ` Jan Beulich
  0 siblings, 1 reply; 5+ messages in thread
From: Kyungsik Lee @ 2013-11-11  2:49 UTC (permalink / raw)
  To: Jan Beulich; +Cc: linux-kernel, Matthew Daley, akpm, hyojun.im, chan.jeong

Hello Jan,

Thanks for the patch.

On Fri, Nov 08, 2013 at 09:27:09AM +0000, Jan Beulich wrote:
> "ret", being set to -1 early on, gets cleared by the first invocation
> of lz4_decompress()/lz4_decompress_unknownoutputsize(), and hence
> subsequent failures wouldn't be noticed by the caller without setting
> it back to -1 right after those calls.
> 
> Reported-by: Matthew Daley <mattjd@gmail.com>
> Signed-off-by: Jan Beulich <jbeulich@suse.com>
> Cc: Kyungsik Lee <kyungsik.lee@lge.com>
> Cc: Andrew Morton <akpm@linux-foundation.org>
> 
> --- a/lib/decompress_unlz4.c
> +++ b/lib/decompress_unlz4.c
> @@ -141,6 +141,7 @@ STATIC inline int INIT unlz4(u8 *input, 
>  			goto exit_2;
>  		}
>  
> +		ret = -1;
>  		if (flush && flush(outp, dest_len) != dest_len)
>  			goto exit_2;
>  		if (output)
>
What do you think of adding "ret2" for keeping "ret" error status
which is set by lz4_decompress*() like below.

{
	int ret2;

	ret2 = lz4_decompress(inp, &chunksize, outp, dest_len);
	if (ret2 < 0) {

	}

Thanks,
Kyungsik


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

* Re: [PATCH] unlz4: always set an error return code on failures
  2013-11-11  2:49 ` Kyungsik Lee
@ 2013-11-11  8:35   ` Jan Beulich
  2013-11-11 13:02     ` Kyungsik Lee
  0 siblings, 1 reply; 5+ messages in thread
From: Jan Beulich @ 2013-11-11  8:35 UTC (permalink / raw)
  To: Kyungsik Lee; +Cc: Matthew Daley, chan.jeong, hyojun.im, akpm, linux-kernel

>>> On 11.11.13 at 03:49, Kyungsik Lee <kyungsik.lee@lge.com> wrote:
> Hello Jan,
> 
> Thanks for the patch.
> 
> On Fri, Nov 08, 2013 at 09:27:09AM +0000, Jan Beulich wrote:
>> "ret", being set to -1 early on, gets cleared by the first invocation
>> of lz4_decompress()/lz4_decompress_unknownoutputsize(), and hence
>> subsequent failures wouldn't be noticed by the caller without setting
>> it back to -1 right after those calls.
>> 
>> Reported-by: Matthew Daley <mattjd@gmail.com>
>> Signed-off-by: Jan Beulich <jbeulich@suse.com>
>> Cc: Kyungsik Lee <kyungsik.lee@lge.com>
>> Cc: Andrew Morton <akpm@linux-foundation.org>
>> 
>> --- a/lib/decompress_unlz4.c
>> +++ b/lib/decompress_unlz4.c
>> @@ -141,6 +141,7 @@ STATIC inline int INIT unlz4(u8 *input, 
>>  			goto exit_2;
>>  		}
>>  
>> +		ret = -1;
>>  		if (flush && flush(outp, dest_len) != dest_len)
>>  			goto exit_2;
>>  		if (output)
>>
> What do you think of adding "ret2" for keeping "ret" error status
> which is set by lz4_decompress*() like below.

I'd be fine with that too, but preferred to submit the smallest
possible (read: one line) patch in this case.

Jan


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

* Re: [PATCH] unlz4: always set an error return code on failures
  2013-11-11  8:35   ` Jan Beulich
@ 2013-11-11 13:02     ` Kyungsik Lee
  2013-11-11 13:33       ` Jan Beulich
  0 siblings, 1 reply; 5+ messages in thread
From: Kyungsik Lee @ 2013-11-11 13:02 UTC (permalink / raw)
  To: Jan Beulich; +Cc: Matthew Daley, chan.jeong, hyojun.im, akpm, linux-kernel

On Mon, Nov 11, 2013 at 08:35:31AM +0000, Jan Beulich wrote:
> >>> On 11.11.13 at 03:49, Kyungsik Lee <kyungsik.lee@lge.com> wrote:
> > Hello Jan,
> > 
> > Thanks for the patch.
> > 
> > On Fri, Nov 08, 2013 at 09:27:09AM +0000, Jan Beulich wrote:
> >> "ret", being set to -1 early on, gets cleared by the first invocation
> >> of lz4_decompress()/lz4_decompress_unknownoutputsize(), and hence
> >> subsequent failures wouldn't be noticed by the caller without setting
> >> it back to -1 right after those calls.
> >> 
> >> Reported-by: Matthew Daley <mattjd@gmail.com>
> >> Signed-off-by: Jan Beulich <jbeulich@suse.com>
> >> Cc: Kyungsik Lee <kyungsik.lee@lge.com>
> >> Cc: Andrew Morton <akpm@linux-foundation.org>
> >> 
> >> --- a/lib/decompress_unlz4.c
> >> +++ b/lib/decompress_unlz4.c
> >> @@ -141,6 +141,7 @@ STATIC inline int INIT unlz4(u8 *input, 
> >>  			goto exit_2;
> >>  		}
> >>  
> >> +		ret = -1;
> >>  		if (flush && flush(outp, dest_len) != dest_len)
> >>  			goto exit_2;
> >>  		if (output)
> >>
> > What do you think of adding "ret2" for keeping "ret" error status
> > which is set by lz4_decompress*() like below.
> 
> I'd be fine with that too, but preferred to submit the smallest
> possible (read: one line) patch in this case.
>
I think it looks neat avoiding "ret" being set to error status
in the loop. Can you please resend the patch with those changes?

Acked-by: Kyungsik Lee <kyungsik.lee@lge.com>

Thanks,
Kyungsik

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

* Re: [PATCH] unlz4: always set an error return code on failures
  2013-11-11 13:02     ` Kyungsik Lee
@ 2013-11-11 13:33       ` Jan Beulich
  0 siblings, 0 replies; 5+ messages in thread
From: Jan Beulich @ 2013-11-11 13:33 UTC (permalink / raw)
  To: Kyungsik Lee; +Cc: Matthew Daley, chan.jeong, hyojun.im, akpm, linux-kernel

>>> On 11.11.13 at 14:02, Kyungsik Lee <kyungsik.lee@lge.com> wrote:
> On Mon, Nov 11, 2013 at 08:35:31AM +0000, Jan Beulich wrote:
>> >>> On 11.11.13 at 03:49, Kyungsik Lee <kyungsik.lee@lge.com> wrote:
>> > Hello Jan,
>> > 
>> > Thanks for the patch.
>> > 
>> > On Fri, Nov 08, 2013 at 09:27:09AM +0000, Jan Beulich wrote:
>> >> "ret", being set to -1 early on, gets cleared by the first invocation
>> >> of lz4_decompress()/lz4_decompress_unknownoutputsize(), and hence
>> >> subsequent failures wouldn't be noticed by the caller without setting
>> >> it back to -1 right after those calls.
>> >> 
>> >> Reported-by: Matthew Daley <mattjd@gmail.com>
>> >> Signed-off-by: Jan Beulich <jbeulich@suse.com>
>> >> Cc: Kyungsik Lee <kyungsik.lee@lge.com>
>> >> Cc: Andrew Morton <akpm@linux-foundation.org>
>> >> 
>> >> --- a/lib/decompress_unlz4.c
>> >> +++ b/lib/decompress_unlz4.c
>> >> @@ -141,6 +141,7 @@ STATIC inline int INIT unlz4(u8 *input, 
>> >>  			goto exit_2;
>> >>  		}
>> >>  
>> >> +		ret = -1;
>> >>  		if (flush && flush(outp, dest_len) != dest_len)
>> >>  			goto exit_2;
>> >>  		if (output)
>> >>
>> > What do you think of adding "ret2" for keeping "ret" error status
>> > which is set by lz4_decompress*() like below.
>> 
>> I'd be fine with that too, but preferred to submit the smallest
>> possible (read: one line) patch in this case.
>>
> I think it looks neat avoiding "ret" being set to error status
> in the loop. Can you please resend the patch with those changes?

I'm sorry, I'm confused - on one hand you're asking for changes
(which I'm not going to do - I proposed the patch as is, and am
not going to put my name under one that's introducing ugliness
like "ret2"), ...

> Acked-by: Kyungsik Lee <kyungsik.lee@lge.com>

... yet then you give your ack to the existing patch.

Jan


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

end of thread, other threads:[~2013-11-11 13:33 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-11-08  9:27 [PATCH] unlz4: always set an error return code on failures Jan Beulich
2013-11-11  2:49 ` Kyungsik Lee
2013-11-11  8:35   ` Jan Beulich
2013-11-11 13:02     ` Kyungsik Lee
2013-11-11 13:33       ` Jan Beulich

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox