Re: [PATCH] Fix memswp, its scratch space was too small

From: Jens Axboe <jens.axboe_at_oracle.com>
Date: Thu, 2 Aug 2007 18:40:02 +0200

On Wed, Aug 01 2007, Shawn Lewis wrote:
> diff --git a/verify.c b/verify.c
> index f34609c..5bdfb76 100644
> --- a/verify.c
> +++ b/verify.c
> @@ -83,7 +83,7 @@ static void fill_pattern(struct thread_d
>
> static void memswp(void* buf1, void* buf2, unsigned int len)
> {
> - struct verify_header swap;
> + char swap[200];
>
> memcpy(&swap, buf1, len);
> memcpy(buf1, buf2, len);
>

Oops indeed, my bad. 200 is enough just now, but I think you should add
a

        assert(len <= sizeof(swap));

as well so we don't get a bug like this in the future. Can you resend
with that?

-- 
Jens Axboe
Received on Thu Aug 02 2007 - 18:40:02 CEST

This archive was generated by hypermail 2.2.0 : Thu Aug 02 2007 - 19:00:02 CEST