Re: [PATCH] 9p bug fix: return non-zero error value in p9_put_data

From: Eric Van Hensbergen
Date: Tue Sep 23 2008 - 16:33:24 EST


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@xxxxxxxx> 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@xxxxxxxx>
> ---

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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/