All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alexey Dobriyan <adobriyan@gmail.com>
To: viro@zeniv.linux.org.uk
Cc: linux-fsdevel@vger.kernel.org
Subject: [PATCH] dup: delete error write to stack variable on common path
Date: Sat, 23 Oct 2021 15:39:52 +0300	[thread overview]
Message-ID: <YXQCmPai9Sn0qF0T@localhost.localdomain> (raw)

Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
---

 fs/file.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

--- a/fs/file.c
+++ b/fs/file.c
@@ -291,10 +291,11 @@ struct files_struct *dup_fd(struct files_struct *oldf, unsigned int max_fds, int
 	unsigned int open_files, i;
 	struct fdtable *old_fdt, *new_fdt;
 
-	*errorp = -ENOMEM;
 	newf = kmem_cache_alloc(files_cachep, GFP_KERNEL);
-	if (!newf)
+	if (!newf) {
+		*errorp = -ENOMEM;
 		goto out;
+	}
 
 	atomic_set(&newf->count, 1);
 

                 reply	other threads:[~2021-10-23 12:39 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YXQCmPai9Sn0qF0T@localhost.localdomain \
    --to=adobriyan@gmail.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=viro@zeniv.linux.org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.