diff mbox

cifs: propagate cifs_new_fileinfo() error back to the caller

Message ID 1273504344-18795-1-git-send-email-sjayaraman@suse.de
State New
Headers show

Commit Message

Suresh Jayaraman May 10, 2010, 3:12 p.m. UTC
..otherwise memory allocation errors go undetected.

Signed-off-by: Suresh Jayaraman <sjayaraman@suse.de>
---
 fs/cifs/dir.c |   17 +++++++++++++----
 1 files changed, 13 insertions(+), 4 deletions(-)

Comments

Steve French May 10, 2010, 6:04 p.m. UTC | #1
Looks fine except checkpatch warnings - could you please fix those.

$ scripts/checkpatch.pl ~/suresh3.patch
ERROR: code indent should use tabs where possible
#44: FILE: fs/cifs/dir.c:268:
+^I^I^I^I              oflags);$

ERROR: code indent should use tabs where possible
#63: FILE: fs/cifs/dir.c:491:
+^I^I^I^I               nd->path.mnt, oflags);$

total: 2 errors, 0 warnings, 33 lines checked

/home/sfrench/suresh3.patch has style problems, please review.  If any
of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.


On Mon, May 10, 2010 at 10:12 AM, Suresh Jayaraman <sjayaraman@suse.de> wrote:
> ..otherwise memory allocation errors go undetected.
>
> Signed-off-by: Suresh Jayaraman <sjayaraman@suse.de>
> ---
>  fs/cifs/dir.c |   17 +++++++++++++----
>  1 files changed, 13 insertions(+), 4 deletions(-)
>
> diff --git a/fs/cifs/dir.c b/fs/cifs/dir.c
> index bd363df..b5edbe7 100644
> --- a/fs/cifs/dir.c
> +++ b/fs/cifs/dir.c
> @@ -261,8 +261,14 @@ int cifs_posix_open(char *full_path, struct inode **pinode,
>         * cifs_fill_filedata() takes care of setting cifsFileInfo pointer to
>         * file->private_data.
>         */
> -       if (mnt)
> -               cifs_new_fileinfo(*pinode, *pnetfid, NULL, mnt, oflags);
> +       if (mnt) {
> +               struct cifsFileInfo *pfile_info;
> +
> +               pfile_info = cifs_new_fileinfo(*pinode, *pnetfid, NULL, mnt,
> +                                             oflags);
> +               if (pfile_info == NULL)
> +                       rc = -ENOMEM;
> +       }
>
>  posix_open_ret:
>        kfree(presp_data);
> @@ -476,12 +482,15 @@ cifs_create_set_dentry:
>                /* mknod case - do not leave file open */
>                CIFSSMBClose(xid, tcon, fileHandle);
>        } else if (!(posix_create) && (newinode)) {
> +               struct cifsFileInfo *pfile_info;
>                /*
>                 * cifs_fill_filedata() takes care of setting cifsFileInfo
>                 * pointer to file->private_data.
>                 */
> -               cifs_new_fileinfo(newinode, fileHandle, NULL, nd->path.mnt,
> -                                 oflags);
> +               pfile_info = cifs_new_fileinfo(newinode, fileHandle, NULL,
> +                                              nd->path.mnt, oflags);
> +               if (pfile_info == NULL)
> +                       rc = -ENOMEM;
>        }
>  cifs_create_out:
>        kfree(buf);
>
diff mbox

Patch

diff --git a/fs/cifs/dir.c b/fs/cifs/dir.c
index bd363df..b5edbe7 100644
--- a/fs/cifs/dir.c
+++ b/fs/cifs/dir.c
@@ -261,8 +261,14 @@  int cifs_posix_open(char *full_path, struct inode **pinode,
 	 * cifs_fill_filedata() takes care of setting cifsFileInfo pointer to
 	 * file->private_data.
 	 */
-	if (mnt)
-		cifs_new_fileinfo(*pinode, *pnetfid, NULL, mnt, oflags);
+	if (mnt) {
+		struct cifsFileInfo *pfile_info;
+
+		pfile_info = cifs_new_fileinfo(*pinode, *pnetfid, NULL, mnt,
+				              oflags);
+		if (pfile_info == NULL)
+			rc = -ENOMEM;
+	}
 
 posix_open_ret:
 	kfree(presp_data);
@@ -476,12 +482,15 @@  cifs_create_set_dentry:
 		/* mknod case - do not leave file open */
 		CIFSSMBClose(xid, tcon, fileHandle);
 	} else if (!(posix_create) && (newinode)) {
+		struct cifsFileInfo *pfile_info;
 		/*
 		 * cifs_fill_filedata() takes care of setting cifsFileInfo
 		 * pointer to file->private_data.
 		 */
-		cifs_new_fileinfo(newinode, fileHandle, NULL, nd->path.mnt,
-				  oflags);
+		pfile_info = cifs_new_fileinfo(newinode, fileHandle, NULL,
+				               nd->path.mnt, oflags);
+		if (pfile_info == NULL)
+			rc = -ENOMEM;
 	}
 cifs_create_out:
 	kfree(buf);