From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753761AbbJNORE (ORCPT ); Wed, 14 Oct 2015 10:17:04 -0400 Received: from mx2.suse.de ([195.135.220.15]:57987 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753512AbbJNORB (ORCPT ); Wed, 14 Oct 2015 10:17:01 -0400 Date: Wed, 14 Oct 2015 07:16:48 -0700 From: Davidlohr Bueso To: Andrew Morton Cc: Stanislav Kinsbursky , linux-kernel@vger.kernel.org, dave@stgolabs.net Subject: [PATCH] ipc,msg: drop dst nil validation in copy_msg Message-ID: <20151014141648.GD3052@linux-uzut.site> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- 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