Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp1038283pxu; Mon, 23 Nov 2020 10:02:41 -0800 (PST) X-Google-Smtp-Source: ABdhPJzFyjs5ghyxPwKSEVULg6Sv7uTqQim7waLzywO8xmmmofC0uR3BbnpjWXEJoIWb8F19SoZy X-Received: by 2002:a50:fe02:: with SMTP id f2mr356948edt.97.1606154561003; Mon, 23 Nov 2020 10:02:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606154560; cv=none; d=google.com; s=arc-20160816; b=L8WPGcWgVtPPTpJEGVT3GbXXi2g4NUOg6gzkq15oZm86p5V2eWt2rZnOGzEfLOwaPJ tR+K8p2BWO/gJEyc+QWgV+TXEnD+mWdDnj4W0XZOL8EeKwYl7FFGFXPoAcBL2fouEnTt fhCvZR023XORWAoqdHgLCFsqbvGpvPXQ+Tmpyrm+XIQS3nXsUXgws48KuCvVzk7PkZH+ fmhum+8qStppAO79jP13BG5iyH9qKTrbfdy+9kzKhFv0jax1SIWsR0JWn5UyC2YbfAfx +GKodv2kYQM2pkNAeov+UwMGtb+MOqgjoJ9g5XElCrp7E/C5Dr0clYQB0yPvxERqh5xT ivoA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :ironport-sdr:ironport-sdr; bh=sd0WypG4/P7yvHu94LTvC1tTwpF5knpeU32q60JfUic=; b=SCCGJGqo6BmvItUdGktk8XwnxAIEp6JBECFRnD+6i2ddRFS0AY6u3LRjBcluv+E8gJ ref4iwdX9RKzv5i2gMYAs/Ja3/fTofzwJ+R3S7muVKEnRSPjU2Sy6fZRJ9aZpkj4A8lm 2hDsUrZMaNKqAflz8B1ZOtvbCxqaCTpUlaNmJMCvOV6s+i/7Eh/P+USHtNtgQKJmwi/Z 2NlnXmQ+aODUHbJhRtxihnwR+7SiXxdBPT898szi4Ckp9wFJUMeXVChPDiobbE5qJayW cCxfxGvcN26GdDWZiNoHRw7cbwUWJ+29jvhErt2g2CLTz3zIWGMsFw3O2a8vfrqpkOdB ZgXQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id u14si6979890eds.372.2020.11.23.10.02.16; Mon, 23 Nov 2020 10:02:40 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390614AbgKWR7w (ORCPT + 99 others); Mon, 23 Nov 2020 12:59:52 -0500 Received: from mga12.intel.com ([192.55.52.136]:8398 "EHLO mga12.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390610AbgKWR7w (ORCPT ); Mon, 23 Nov 2020 12:59:52 -0500 IronPort-SDR: wqUkqw/qeh8V0/ba/9r5bNWTVgO9kjtO9w8qks4YzRFObduHCN+PI19eeYGK9ITSmbSzuWAKCc /QGYzIuhaq/Q== X-IronPort-AV: E=McAfee;i="6000,8403,9814"; a="151072625" X-IronPort-AV: E=Sophos;i="5.78,364,1599548400"; d="scan'208";a="151072625" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Nov 2020 09:59:52 -0800 IronPort-SDR: duHfIIVTNvV65/0AdPRzgIGLvxPFyjofGjd781D1oylk5RL1U45olbrp/VQmqqVbI+z1S2o8ne 96cZz0rF9vaQ== X-IronPort-AV: E=Sophos;i="5.78,364,1599548400"; d="scan'208";a="478196756" Received: from suygunge-mobl.ger.corp.intel.com (HELO localhost) ([10.249.40.108]) by orsmga004-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Nov 2020 09:59:49 -0800 From: Jani Nikula To: linux-kernel@vger.kernel.org Cc: Christoph Hellwig , Andrew Morton , intel-gfx@lists.freedesktop.org, jani.nikula@intel.com Subject: [PATCH 2/9] relay: require non-NULL callbacks in relay_open() Date: Mon, 23 Nov 2020 19:59:22 +0200 Message-Id: X-Mailer: git-send-email 2.20.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org There are no clients passing NULL callbacks, which makes sense as it wouldn't even create a file. Require non-NULL callbacks, and throw away the handling for NULL callbacks. Suggested-by: Christoph Hellwig Cc: Christoph Hellwig Signed-off-by: Jani Nikula --- kernel/relay.c | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/kernel/relay.c b/kernel/relay.c index b51343642bf4..d9b8185161a8 100644 --- a/kernel/relay.c +++ b/kernel/relay.c @@ -291,13 +291,6 @@ static int remove_buf_file_default_callback(struct dentry *dentry) return -EINVAL; } -/* relay channel default callbacks */ -static struct rchan_callbacks default_channel_callbacks = { - .subbuf_start = subbuf_start_default_callback, - .create_buf_file = create_buf_file_default_callback, - .remove_buf_file = remove_buf_file_default_callback, -}; - /** * wakeup_readers - wake up readers waiting on a channel * @work: contains the channel buffer @@ -472,11 +465,6 @@ static void relay_close_buf(struct rchan_buf *buf) static void setup_callbacks(struct rchan *chan, struct rchan_callbacks *cb) { - if (!cb) { - chan->cb = &default_channel_callbacks; - return; - } - if (!cb->subbuf_start) cb->subbuf_start = subbuf_start_default_callback; if (!cb->create_buf_file) @@ -542,6 +530,8 @@ struct rchan *relay_open(const char *base_filename, return NULL; if (subbuf_size > UINT_MAX / n_subbufs) return NULL; + if (!cb) + return NULL; chan = kzalloc(sizeof(struct rchan), GFP_KERNEL); if (!chan) -- 2.20.1