All of lore.kernel.org
 help / color / mirror / Atom feed
From: Greg KH <gregkh@linuxfoundation.org>
To: Jiri Slaby <jslaby@suse.cz>
Cc: linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 3/9] vt: selection, remove 2 local variables from set_selection_kernel
Date: Fri, 6 Mar 2020 08:37:45 +0100	[thread overview]
Message-ID: <20200306073745.GA3618933@kroah.com> (raw)
In-Reply-To: <75287ce8-d2ce-9c00-601a-486757e8860b@suse.cz>

On Mon, Feb 24, 2020 at 10:26:50AM +0100, Jiri Slaby wrote:
> On 21. 02. 20, 10:32, Greg KH wrote:
> > On Wed, Feb 19, 2020 at 08:39:45AM +0100, Jiri Slaby wrote:
> >> multiplier and mode are not actually needed:
> >> * multiplier is used only in kmalloc_array, so use "use_unicode ? 4 : 1"
> >>   directly
> >> * mode is used only to assign a bool in this manner:
> >>   if (cond)
> >>     x = true;
> >>   else
> >>     x = false;
> >>   So do "x = cond" directly.
> >>
> >> Signed-off-by: Jiri Slaby <jslaby@suse.cz>
> >> ---
> >>  drivers/tty/vt/selection.c | 14 +++++---------
> >>  1 file changed, 5 insertions(+), 9 deletions(-)
> >>
> >> diff --git a/drivers/tty/vt/selection.c b/drivers/tty/vt/selection.c
> >> index 714992693974..6541c09d8bba 100644
> >> --- a/drivers/tty/vt/selection.c
> >> +++ b/drivers/tty/vt/selection.c
> >> @@ -191,9 +191,9 @@ int set_selection_kernel(struct tiocl_selection *v, struct tty_struct *tty)
> >>  	struct vc_data *vc = vc_cons[fg_console].d;
> >>  	int new_sel_start, new_sel_end, spc;
> >>  	char *bp, *obp;
> >> -	int i, ps, pe, multiplier;
> >> +	int i, ps, pe;
> >>  	u32 c;
> >> -	int mode, ret = 0;
> >> +	int ret = 0;
> >>  
> >>  	poke_blanked_console();
> >>  
> >> @@ -224,11 +224,7 @@ int set_selection_kernel(struct tiocl_selection *v, struct tty_struct *tty)
> >>  		clear_selection();
> >>  		sel_cons = vc_cons[fg_console].d;
> >>  	}
> >> -	mode = vt_do_kdgkbmode(fg_console);
> >> -	if (mode == K_UNICODE)
> >> -		use_unicode = 1;
> >> -	else
> >> -		use_unicode = 0;
> >> +	use_unicode = vt_do_kdgkbmode(fg_console) == K_UNICODE;
> >>  
> >>  	switch (v->sel_mode)
> >>  	{
> >> @@ -312,8 +308,8 @@ int set_selection_kernel(struct tiocl_selection *v, struct tty_struct *tty)
> >>  	sel_end = new_sel_end;
> >>  
> >>  	/* Allocate a new buffer before freeing the old one ... */
> >> -	multiplier = use_unicode ? 4 : 1;  /* chars can take up to 4 bytes */
> >> -	bp = kmalloc_array((sel_end - sel_start) / 2 + 1, multiplier,
> >> +	/* chars can take up to 4 bytes with unicode */
> >> +	bp = kmalloc_array((sel_end - sel_start) / 2 + 1, use_unicode ? 4 : 1,
> >>  			   GFP_KERNEL);
> >>  	if (!bp) {
> >>  		printk(KERN_WARNING "selection: kmalloc() failed\n");
> >> -- 
> >> 2.25.0
> >>
> > 
> > This patch fails to apply to my tree, so I stopped here.  Can you rebase
> > and resend the rest of these?
> 
> Could you be a little bit more specific? After the rebase, it still
> applies cleanly for me. Perhaps the tree you are applying this to was
> missing this 5.6-rc3 commit:
> commit 07e6124a1a46b4b5a9b3cacc0c306b50da87abf5
> Author: Jiri Slaby <jslaby@suse.cz>
> Date:   Mon Feb 10 09:11:31 2020 +0100
> 
>     vt: selection, close sel_buffer race
> ?

Yes, I did not have your other patches in the branch I was using, as
those were to go to Linus for this current release.

I've fixed this up now and applied the rest, thanks.

greg k-h

  reply	other threads:[~2020-03-06  7:38 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-19  7:39 [PATCH 1/9] vt: selection, introduce vc_is_sel Jiri Slaby
2020-02-19  7:39 ` [PATCH 2/9] vt: ioctl, switch VT_IS_IN_USE and VT_BUSY to inlines Jiri Slaby
2020-02-19  7:39 ` [PATCH 3/9] vt: selection, remove 2 local variables from set_selection_kernel Jiri Slaby
2020-02-21  9:32   ` Greg KH
2020-02-24  9:26     ` Jiri Slaby
2020-03-06  7:37       ` Greg KH [this message]
2020-02-19  7:39 ` [PATCH 4/9] vt: selection, localize use_unicode Jiri Slaby
2020-02-19  7:39 ` [PATCH 5/9] vt: selection, create struct from console selection globals Jiri Slaby
2020-02-19  7:39 ` [PATCH 6/9] vt: switch vt_dont_switch to bool Jiri Slaby
2020-02-19  7:39 ` [PATCH 7/9] vt: vt_kern.h, remove extern from functions Jiri Slaby
2020-02-19  7:39 ` [PATCH 8/9] vt: selection, remove redeclaration of poke_blanked_console Jiri Slaby
2020-02-19  7:39 ` [PATCH 9/9] vt: selection, indent switch-case properly Jiri Slaby

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=20200306073745.GA3618933@kroah.com \
    --to=gregkh@linuxfoundation.org \
    --cc=jslaby@suse.cz \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-serial@vger.kernel.org \
    /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.