RE: [PATCH] tty: vt: fix the dead code at .vc_allocate() function

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Jiri Slaby <jslaby@xxxxxxx> Sent: Thursday, January 21, 2016 4:28 PM
> To: b38611@xxxxxxxxxxxxx; gregkh@xxxxxxxxxxxxxxxxxxx
> Cc: dh.herrmann@xxxxxxxxx; peter@xxxxxxxxxxxxxxxxxx;
> daniel.vetter@xxxxxxxxx; xiaoming.wang@xxxxxxxxx; Fugang Duan
> <fugang.duan@xxxxxxx>; hofrat@xxxxxxxxx; linux-serial@xxxxxxxxxxxxxxx
> Subject: Re: [PATCH] tty: vt: fix the dead code at .vc_allocate() function
> 
> On 01/21/2016, 05:52 AM, Fugang Duan wrote:
> > The vt CONSOLE number is 1 ~ 63, and users CONSOLE is 63
> 
> No, users CONSOLE is 1 ~ 63 too. Actually both are 0 ~ 62, right?
> 
Yes.

So, the code is really dead code here and confused.
if (currcons >= MAX_NR_USER_CONSOLES && !capable(CAP_SYS_RESOURCE))
              return -EPERM;

> > --- a/drivers/tty/vt/vt.c
> > +++ b/drivers/tty/vt/vt.c
> > @@ -762,14 +762,14 @@ int vc_allocate(unsigned int currcons)	/*
> return 0 on success */
> >  {
> >  	WARN_CONSOLE_UNLOCKED();
> >
> > -	if (currcons >= MAX_NR_CONSOLES)
> > +	if (currcons > MAX_NR_CONSOLES)
> >  		return -ENXIO;
> >  	if (!vc_cons[currcons].d) {
> 
> !vc_cons[63].d would be -EHOLE. Hence NACK.
> 
> >  	    struct vc_data *vc;
> >  	    struct vt_notifier_param param;
> >
> >  	    /* prevent users from taking too much memory */
> > -	    if (currcons >= MAX_NR_USER_CONSOLES
> && !capable(CAP_SYS_RESOURCE))
> > +	    if (currcons == MAX_NR_USER_CONSOLES
> && !capable(CAP_SYS_RESOURCE))
> >  	      return -EPERM;
> 
> It's like this since 1.1.54.
> 
> I believe we can drop it along with MAX_NR_USER_CONSOLES macro.
> 

Pls drop MAX_NR_USER_CONSOLES macro. 

> thanks,
> --
> js
> suse labs
--
To unsubscribe from this list: send the line "unsubscribe linux-serial" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux PPP]     [Linux FS]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Linmodem]     [Device Mapper]     [Linux Kernel for ARM]

  Powered by Linux