The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Joel Savitz <jsavitz@redhat.com>
To: linux-kernel@vger.kernel.org
Cc: Joel Savitz <jsavitz@redhat.com>,
	Christian Brauner <brauner@kernel.org>,
	Al Viro <viro@zeniv.linux.org.uk>
Subject: [PATCH 1/3] kernel/nsproxy: remove unnecessary guard in validate_nsset()
Date: Fri, 30 May 2025 16:03:04 -0400	[thread overview]
Message-ID: <20250530200305.85319-3-jsavitz@redhat.com> (raw)
In-Reply-To: <20250530200305.85319-2-jsavitz@redhat.com>

By the same logic as commit 5caa2d89b7f1 ("kernel/nsproxy: remove
unnecessary guards"), remove the guard around put_pid_ns() in
validate_nsset() as put_pid_ns() already performs the NULL check.

Signed-off-by: Joel Savitz <jsavitz@redhat.com>
---
 kernel/nsproxy.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/kernel/nsproxy.c b/kernel/nsproxy.c
index 5f31fdff8a38..be89e006e6aa 100644
--- a/kernel/nsproxy.c
+++ b/kernel/nsproxy.c
@@ -481,8 +481,7 @@ static int validate_nsset(struct nsset *nsset, struct pid *pid)
 #endif
 
 out:
-	if (pid_ns)
-		put_pid_ns(pid_ns);
+	put_pid_ns(pid_ns);
 	if (nsp)
 		put_nsproxy(nsp);
 	put_user_ns(user_ns);
-- 
2.45.2


  reply	other threads:[~2025-05-30 20:03 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-05-30 20:03 [PATCH 0/3] kernel/nsproxy: Minor nsproxy code simplification Joel Savitz
2025-05-30 20:03 ` Joel Savitz [this message]
2025-05-30 20:03 ` [PATCH 2/3] kernel/nsproxy: fix put_*() call ordering in validate_nsset() Joel Savitz
2025-05-30 20:03 ` [PATCH 3/3] kernel/nsproxy: utilize cleanup helper for nsproxy references Joel Savitz
2025-06-09 14:23 ` [PATCH 0/3] kernel/nsproxy: Minor nsproxy code simplification Joel Savitz
2025-06-18 19:49   ` Joel Savitz
2025-07-01 16:41     ` Joel Savitz
2025-07-07 14:37       ` Joel Savitz
2025-07-14 12:22 ` Christian Brauner

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=20250530200305.85319-3-jsavitz@redhat.com \
    --to=jsavitz@redhat.com \
    --cc=brauner@kernel.org \
    --cc=linux-kernel@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox