Re: [PATCH 1/3] cw1200: Don't leak memory if krealloc failes

2016-09-30 Thread Johannes Thumshirn
On Fri, Sep 30, 2016 at 03:56:45PM +0300, Sergei Shtylyov wrote: > Hello. > > On 9/30/2016 3:11 PM, Johannes Thumshirn wrote: > > > The call to krealloc() in wsm_buf_reserve() directly assigns the newly > > returned memory to buf->begin. This is all fine except when krealloc() > > failes we loose

Re: [PATCH 1/3] cw1200: Don't leak memory if krealloc failes

2016-09-30 Thread Sergei Shtylyov
Hello. On 9/30/2016 3:11 PM, Johannes Thumshirn wrote: The call to krealloc() in wsm_buf_reserve() directly assigns the newly returned memory to buf->begin. This is all fine except when krealloc() failes we loose the ability to free the old memory pointed to by Fails. buf->begin. If we j

Re: [PATCH 1/3] cw1200: Don't leak memory if krealloc failes

2016-09-30 Thread Johannes Thumshirn
On Fri, Sep 30, 2016 at 02:29:39PM +0200, Johannes Berg wrote: > > > + tmp = krealloc(buf->begin, size, GFP_KERNEL | GFP_DMA); > > + if (tmp) { > > > I think that check is inverted? > > johannes Fu.. you're right, of cause it's !tmp. I'll resend. Thanks, Johannes -- Johannes Thu

Re: [PATCH 1/3] cw1200: Don't leak memory if krealloc failes

2016-09-30 Thread Johannes Berg
> + tmp = krealloc(buf->begin, size, GFP_KERNEL | GFP_DMA); > + if (tmp) { > I think that check is inverted? johannes

[PATCH 1/3] cw1200: Don't leak memory if krealloc failes

2016-09-30 Thread Johannes Thumshirn
The call to krealloc() in wsm_buf_reserve() directly assigns the newly returned memory to buf->begin. This is all fine except when krealloc() failes we loose the ability to free the old memory pointed to by buf->begin. If we just create a temporary variable to assign memory to and assign the memory