]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - net/9p/conv.c
9p: fix put_data error handling
[linux-2.6-omap-h63xx.git] / net / 9p / conv.c
index 44547201f5bcce723787cbeeee1c5a541a51ba3e..5ad3a3bd73b297725aed1c7998c0da80e9bdf2ae 100644 (file)
@@ -451,8 +451,10 @@ p9_put_data(struct cbuf *bufp, const char *data, int count,
                   unsigned char **pdata)
 {
        *pdata = buf_alloc(bufp, count);
+       if (*pdata == NULL)
+               return -ENOMEM;
        memmove(*pdata, data, count);
-       return count;
+       return 0;
 }
 
 static int
@@ -460,6 +462,8 @@ p9_put_user_data(struct cbuf *bufp, const char __user *data, int count,
                   unsigned char **pdata)
 {
        *pdata = buf_alloc(bufp, count);
+       if (*pdata == NULL)
+               return -ENOMEM;
        return copy_from_user(*pdata, data, count);
 }