linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Re: Linux 2.4.7-ac9 (breaks ATM connect)
@ 2001-08-09 21:32 Petr Vandrovec
  0 siblings, 0 replies; 5+ messages in thread
From: Petr Vandrovec @ 2001-08-09 21:32 UTC (permalink / raw)
  To: Sampsa Ranta; +Cc: linux-kernel, laughing

On  9 Aug 01 at 22:27, Sampsa Ranta wrote:
> On Thu, 9 Aug 2001, Sampsa Ranta wrote:
> 
> > -           vci != ATM_VCI_ANY && vci >> dev->ci_range.vci_bits))
> +           vci != ATM_VCI_ANY && vci >= 1 << dev->ci_range.vci_bits))

As these two are equivalent, probably just reverting patch back
to '>>' is easiest... Maybe that second one is more readable, but
I do not think.
                                        Best regards,
                                                Petr Vandrovec
                                                vandrove@vc.cvut.cz
                                                

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Linux 2.4.7-ac9 (breaks ATM connect)
  2001-08-09 20:30   ` David S. Miller
@ 2001-08-09 20:52     ` Chris Friesen
  0 siblings, 0 replies; 5+ messages in thread
From: Chris Friesen @ 2001-08-09 20:52 UTC (permalink / raw)
  To: David S. Miller; +Cc: Sampsa Ranta, Alan Cox, linux-kernel

"David S. Miller" wrote:
> 
> Sampsa Ranta writes:
>  > Pardon me, bugs come in too easy..
>  >
>  > -           vci != ATM_VCI_ANY && vci >> dev->ci_range.vci_bits))
>  > +           vci != ATM_VCI_ANY && vci >= 1 << dev->ci_range.vci_bits))
>  >
> 
> This is rediculious, why has this expression changed when right
> above it is the same thing:
> 
>           vpi >> dev->ci_range.vpi_bits) || (vci != ATM_VCI_UNSPEC &&
> 
> Shouldn't we be changing that "vpi >> dev->ci_range.vpi_bits" boolean
> test as well?

Am I missing something?  As long as vci is unsigned isn't (vci >>
dev->ci_range.vci_bits) as a boolean value exactly the same thing as (vci >= 1
<< dev->ci_range.vci_bits) ?

As an example, take vci = 10001b and dev->ci_range.vci_bits = 4.  The answer
works out the same either way.

Chris


-- 
Chris Friesen                    | MailStop: 043/33/F10  
Nortel Networks                  | work: (613) 765-0557
3500 Carling Avenue              | fax:  (613) 765-2986
Nepean, ON K2H 8E9 Canada        | email: cfriesen@nortelnetworks.com

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Linux 2.4.7-ac9 (breaks ATM connect)
  2001-08-09 19:24 ` Linux 2.4.7-ac9 (breaks ATM connect) Sampsa Ranta
  2001-08-09 19:27   ` Sampsa Ranta
@ 2001-08-09 20:30   ` David S. Miller
  2001-08-09 20:52     ` Chris Friesen
  1 sibling, 1 reply; 5+ messages in thread
From: David S. Miller @ 2001-08-09 20:30 UTC (permalink / raw)
  To: Sampsa Ranta; +Cc: Alan Cox, linux-kernel


Sampsa Ranta writes:
 > Pardon me, bugs come in too easy..
 > 
 > -           vci != ATM_VCI_ANY && vci >> dev->ci_range.vci_bits))
 > +           vci != ATM_VCI_ANY && vci >= 1 << dev->ci_range.vci_bits))
 > 

This is rediculious, why has this expression changed when right
above it is the same thing:

          vpi >> dev->ci_range.vpi_bits) || (vci != ATM_VCI_UNSPEC &&

Shouldn't we be changing that "vpi >> dev->ci_range.vpi_bits" boolean
test as well?

Later,
David S. Miller
davem@redhat.com

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Linux 2.4.7-ac9 (breaks ATM connect)
  2001-08-09 19:24 ` Linux 2.4.7-ac9 (breaks ATM connect) Sampsa Ranta
@ 2001-08-09 19:27   ` Sampsa Ranta
  2001-08-09 20:30   ` David S. Miller
  1 sibling, 0 replies; 5+ messages in thread
From: Sampsa Ranta @ 2001-08-09 19:27 UTC (permalink / raw)
  To: Alan Cox; +Cc: linux-kernel

On Thu, 9 Aug 2001, Sampsa Ranta wrote:

> -           vci != ATM_VCI_ANY && vci >> dev->ci_range.vci_bits))
> +           vci != ATM_VCI_ANY && vci > 1 << dev->ci_range.vci_bits))

 ..

>                     if (c >= 1 << vcc->dev->ci_range.vci_bits)

Pardon me, bugs come in too easy..

-           vci != ATM_VCI_ANY && vci >> dev->ci_range.vci_bits))
+           vci != ATM_VCI_ANY && vci >= 1 << dev->ci_range.vci_bits))

 - Sampsa Ranta
   sampsa@netsonic.fi



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Linux 2.4.7-ac9 (breaks ATM connect)
  2001-08-07 22:53 Linux 2.4.7-ac9 Alan Cox
@ 2001-08-09 19:24 ` Sampsa Ranta
  2001-08-09 19:27   ` Sampsa Ranta
  2001-08-09 20:30   ` David S. Miller
  0 siblings, 2 replies; 5+ messages in thread
From: Sampsa Ranta @ 2001-08-09 19:24 UTC (permalink / raw)
  To: Alan Cox; +Cc: linux-kernel

On Tue, 7 Aug 2001, Alan Cox wrote:

> o	Fix bug in atm_do_connect_dev (bogus EINVALs)	(Germán González)


--- linux.vanilla/net/atm/common.c      Wed Jul  4 12:21:53 2001
+++ linux.ac/net/atm/common.c   Wed Jul 25 16:28:24 2001
@@ -210,7 +210,7 @@

        if ((vpi != ATM_VPI_UNSPEC && vpi != ATM_VPI_ANY &&
            vpi >> dev->ci_range.vpi_bits) || (vci != ATM_VCI_UNSPEC &&
-           vci != ATM_VCI_ANY && vci >> dev->ci_range.vci_bits))
+           vci != ATM_VCI_ANY && vci > dev->ci_range.vci_bits))
                return -EINVAL;
        if (vci > 0 && vci < ATM_NOT_RSV_VCI &&
!capable(CAP_NET_BIND_SERVICE))
                return -EPERM;

The patch is not correct, this test compares number of allowed bits
to an integer. And due to this, breaks most of ATM. Even signalling
daemons cannot connect.

But yes, the original seems broken, too. I included code bits doing this
check elsewhere in ATM implementation code. I think the correct patch
would be

-           vci != ATM_VCI_ANY && vci >> dev->ci_range.vci_bits))
+           vci != ATM_VCI_ANY && vci > 1 << dev->ci_range.vci_bits))


Code bits taken from elsewhere:

net/atm/atm/atm_misc.c:
                    if (c >= 1 << vcc->dev->ci_range.vci_bits)

drivers/atm/eni.c:
	 dev->ci_range.vci_bits = NR_VCI_LD;

drivers/atm/midway.h:
#define NR_VCI_LD      10              /* log2(NR_VCI) */


Thanks,
   Sampsa Ranta
   sampsa@netsonic.fi



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2001-08-09 20:52 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-08-09 21:32 Linux 2.4.7-ac9 (breaks ATM connect) Petr Vandrovec
  -- strict thread matches above, loose matches on Subject: below --
2001-08-07 22:53 Linux 2.4.7-ac9 Alan Cox
2001-08-09 19:24 ` Linux 2.4.7-ac9 (breaks ATM connect) Sampsa Ranta
2001-08-09 19:27   ` Sampsa Ranta
2001-08-09 20:30   ` David S. Miller
2001-08-09 20:52     ` Chris Friesen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).