Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp3098547yba; Tue, 16 Apr 2019 04:50:10 -0700 (PDT) X-Google-Smtp-Source: APXvYqwFvibZRr6K/cdDYzcfJ+RjmTUT/NwEUd+OlLD9sQbJ/KjUabmbEq/JXJt53HLiVD+10StV X-Received: by 2002:a17:902:988e:: with SMTP id s14mr78795913plp.167.1555415410885; Tue, 16 Apr 2019 04:50:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555415410; cv=none; d=google.com; s=arc-20160816; b=NPE6UpHVoZoUdQ6vCcgdDI3sSJSqUfA60Ybz1APmEkvv8utlpbAjfa22CptipMEs74 w3wZN6NtF4Y52AJwpHRPGR7LQV8iM+QLz5chtmLoA6NCpRnOn9xszTk+JU5/S4dvjirX 8xHvaNMoj7k+xnvJCr+0xVvwNAOPrzZ/HaSNu0oGAmpjwATI94Ct6W35l0mH9SBl5QzW PfPa3gdl17ISDGMfC16g0/DxX84Qls2Ayfsb5dJ0VCwo8jvbisC02nE5B0t+IDtrYTCJ 0SSh/lFgQLw0cXuIVk+EABKnw+wFyjiBUCL3zbTyceWMyOk805cJOnsYN+g8pocUWzK0 GqQA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=DQA2VtrYjZ0Yuzpl3Zv3RLWeERb4rwfTTnSlf+OoYcE=; b=Ep6Wbm7jDWsspaRRdeglAKH2c+iUA2baA36alE/rf4vRYgKY4gMx+ySrZ2GLGfV23K VwR/b4Y/WKpT7XQTvb9Zi3wfcXj/usWjVBReTtsU2SMM/0bgvpHBj+dltSvyajOGXN7c zAaDtJm3/wN++SZOh9Y8qNUNZRWSafUAX8usYWk48YKRFaHDA/PO1VWHMhFP4xmZCX61 joRHLn6s6n5IbfNZrrpyxT1zSBmN/LikdFVoEG4vWgi5zNvPGC3Cl4gTJVycZYfRP8Gx 0FuddsBYyko9q2EUa8aciZDA3zWZVY09rGdqw6CJ3hujaR3YmIELO6eyTHC+6jwyxol3 agVA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=VUAsyr9J; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i8si47947406pfd.275.2019.04.16.04.49.54; Tue, 16 Apr 2019 04:50:10 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=VUAsyr9J; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729304AbfDPLtR (ORCPT + 99 others); Tue, 16 Apr 2019 07:49:17 -0400 Received: from mail.kernel.org ([198.145.29.99]:58770 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726672AbfDPLtQ (ORCPT ); Tue, 16 Apr 2019 07:49:16 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 67B1C20868; Tue, 16 Apr 2019 11:49:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1555415356; bh=LtMWpHgsXULS/07QlpvX0V7UMJoYPCNQUz4xMeaOk9g=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=VUAsyr9JFm02oybxsoiskXtLpIhBKJez8Ae6lSkQQOMLygsqDDWMXHmtkWIRpfgtP ULmkTO8gBg5pOj52XezvDytQlpM4+YzSY5TfVnrTMEFWMOSwmXC2j2RYmjJ9FklRh5 lORPee9tzGQimdCEtM9+4ac7etrZl22dEMceJbDE= Date: Tue, 16 Apr 2019 13:37:40 +0200 From: Greg Kroah-Hartman To: Okash Khawaja Cc: Samuel Thibault , Gregory Nowak , linux-kernel@vger.kernel.org, devel@driverdev.osuosl.org, Kirk Reiser , Peter Hurley , Jiri Slaby , speakup@linux-speakup.org, John Covici , Ben Hutchings , Chris Brannon Subject: Re: [PATCH 1/2] vt: selection: allow functions to be called from inside kernel Message-ID: <20190416113740.GA18054@kroah.com> References: <20190404194530.1170-1-okash.khawaja@gmail.com> <20190404194530.1170-2-okash.khawaja@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190404194530.1170-2-okash.khawaja@gmail.com> User-Agent: Mutt/1.11.4 (2019-03-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Apr 04, 2019 at 08:45:29PM +0100, Okash Khawaja wrote: > This patch breaks set_selection() into two functions so that when > called from kernel, copy_from_user() can be avoided. It also exports > set_selection() and paste_selection(). > > These changes are used the following patch where speakup's selection > functionality calls into the above functions, thereby doing away with > parallel implementation. > > Signed-off-by: Okash Khawaja > Reviewed-by: Samuel Thibault > Tested-by: Gregory Nowak > --- > drivers/tty/vt/selection.c | 37 ++++++++++++++++++++++++------------- > include/linux/selection.h | 3 +-- > 2 files changed, 25 insertions(+), 15 deletions(-) > > diff --git a/drivers/tty/vt/selection.c b/drivers/tty/vt/selection.c > index 07496c711d7d..a43f9cd9bdd6 100644 > --- a/drivers/tty/vt/selection.c > +++ b/drivers/tty/vt/selection.c > @@ -80,6 +80,7 @@ void clear_selection(void) > sel_start = -1; > } > } > +EXPORT_SYMBOL_GPL(clear_selection); > > /* > * User settable table: what characters are to be considered alphabetic? > @@ -164,34 +165,42 @@ static int store_utf8(u32 c, char *p) > * a lot under the lock but its hardly a performance path > */ > int set_selection(const struct tiocl_selection __user *sel, struct tty_struct *tty) > +{ > + struct tiocl_selection v; > + > + if (copy_from_user(&v, sel, sizeof(*sel))) > + return -EFAULT; > + > + return do_set_selection(&v, tty); > +} > + > +int do_set_selection(struct tiocl_selection *v, struct tty_struct *tty) I have no idea what the difference is between set_selection() and do_set_selection() is now. Naming is hard, I know :( How about set_selection_kernel()? set_selection_tiocl()? Something to show that one takes a userspace pointer, and the other a kernel pointer, how about: set_selection_user() set_selection_kernel() making it more obvious? thanks, greg k-h