lkml.org 
[lkml]   [2008]   [Sep]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] 9p bug fix: return non-zero error value in p9_put_data
Hey - first of all, sorry for the long delay on responding to this,
I've just gotten back to my patch queue.

On Tue, Sep 2, 2008 at 2:04 PM, Abhishek Kulkarni <kulkarni@lanl.gov> wrote:
> Resubmitting my previous 9p bug fix patch that removes the bogus return
> value in p9_put_data which made every p9_client_write fail.
>
> Signed-off-by: Abhishek Kulkarni <kulkarni@lanl.gov>
> ---

Please include the original description when resubmitting patches --
this will allow me to suck it into my tree more effectively.

>
> -static int
> +static void
> p9_put_data(struct cbuf *bufp, const char *data, int count,
> unsigned char **pdata)
> {
> *pdata = buf_alloc(bufp, count);
> memmove(*pdata, data, count);
> - return count;
> }
>

What happens if buf_alloc returns NULL?

Isn't the right behavior something more along the lines of:

static int
p9_put_data(struct cbuf *bufp, const char *data, int count,
unsigned char **pdata)
{
*pdata = buf_alloc(bufp, count);'
if(*pdata)
memmove(*pdata, data, count);
return 0;
else
return ENOMEM;
}
-eric


\
 
 \ /
  Last update: 2008-09-23 22:35    [from the cache]
©2003-2011 Jasper Spaans