All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] dup: delete error write to stack variable on common path
@ 2021-10-23 12:39 Alexey Dobriyan
  0 siblings, 0 replies; only message in thread
From: Alexey Dobriyan @ 2021-10-23 12:39 UTC (permalink / raw)
  To: viro; +Cc: linux-fsdevel

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);
 

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-10-23 12:39 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-10-23 12:39 [PATCH] dup: delete error write to stack variable on common path Alexey Dobriyan

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.