All of lore.kernel.org
 help / color / mirror / Atom feed
From: Davidlohr Bueso <dave@stgolabs.net>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Stanislav Kinsbursky <skinsbursky@parallels.com>,
	linux-kernel@vger.kernel.org, dave@stgolabs.net
Subject: [PATCH] ipc,msg: drop dst nil validation in copy_msg
Date: Wed, 14 Oct 2015 07:16:48 -0700	[thread overview]
Message-ID: <20151014141648.GD3052@linux-uzut.site> (raw)

d0edd8528362 (ipc: convert invalid scenarios to use WARN_ON)
relaxed the nil dst parameter check, originally being a full
BUG_ON. However, this check seems quite unnecessary when the
only purpose is for ceckpoint/restore (MSG_COPY flag):

o The copy variable is set initially to nil, apparently as a
way of ensuring that prepare_copy is previously called. Which
is in fact done, unconditionally at the beginning of do_msgrcv.

o There is no concurrency with 'copy' (stack allocated in
do_msgrcv).

Furthermore, any errors in 'copy' (and thus prepare_copy/copy_msg)
should always handled by IS_ERR() family. Therefore remove this
check altogether as it can never occur with the current users.

Signed-off-by: Davidlohr Bueso <dbueso@suse.de>
---
  ipc/msgutil.c | 1 -
  1 file changed, 1 deletion(-)

diff --git a/ipc/msgutil.c b/ipc/msgutil.c
index 71f448e..ed81aaf 100644
--- a/ipc/msgutil.c
+++ b/ipc/msgutil.c
@@ -123,7 +123,6 @@ struct msg_msg *copy_msg(struct msg_msg *src, struct msg_msg *dst)
	size_t len = src->m_ts;
	size_t alen;

-	WARN_ON(dst == NULL);
	if (src->m_ts > dst->m_ts)
		return ERR_PTR(-EINVAL);

--
2.1.4

                 reply	other threads:[~2015-10-14 14:17 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=20151014141648.GD3052@linux-uzut.site \
    --to=dave@stgolabs.net \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=skinsbursky@parallels.com \
    /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.