All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andreas Schwab <schwab@linux-m68k.org>
To: Joe Perches <joe@perches.com>
Cc: Dan Carpenter <dan.carpenter@oracle.com>,
	Karsten Keil <isdn@linux-pingi.de>,
	"David S. Miller" <davem@davemloft.net>,
	Masanari Iida <standby24x7@gmail.com>,
	netdev@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: Re: [patch] isdn: fix a wrapping bug in isdn_ppp_ioctl()
Date: Wed, 10 Oct 2012 12:05:01 +0000	[thread overview]
Message-ID: <m21uh67csy.fsf@igel.home> (raw)
In-Reply-To: <1349864358.2386.27.camel@joe-AO722> (Joe Perches's message of "Wed, 10 Oct 2012 03:19:18 -0700")

Joe Perches <joe@perches.com> writes:

> @@ -589,16 +589,15 @@ isdn_ppp_ioctl(int min, struct file *file, unsigned int cmd, unsigned long arg)
>  		break;
>  	case PPPIOCGCOMPRESSORS:
>  	{
> -		unsigned long protos[8] = {0,};
> +		DECLARE_BITMAP(protos, BITS_PER_LONG * 8) = { 0, };
>  		struct isdn_ppp_compressor *ipc = ipc_head;
> +
>  		while (ipc) {
> -			j = ipc->num / (sizeof(long) * 8);
> -			i = ipc->num % (sizeof(long) * 8);
> -			if (j < 8)
> -				protos[j] |= (0x1 << i);
> +			if (ipc->num < BITS_PER_LONG * 8)
> +				set_bit(ipc->num, protos);
>  			ipc = ipc->next;
>  		}
> -		if ((r = set_arg(argp, protos, 8 * sizeof(long))))
> +		if ((r = set_arg(argp, protos, sizeof(protos))))

This changes the bit endianess.  Since protos is exported to user space
it is an ABI change.

Andreas.

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

WARNING: multiple messages have this Message-ID (diff)
From: Andreas Schwab <schwab@linux-m68k.org>
To: Joe Perches <joe@perches.com>
Cc: Dan Carpenter <dan.carpenter@oracle.com>,
	Karsten Keil <isdn@linux-pingi.de>,
	"David S. Miller" <davem@davemloft.net>,
	Masanari Iida <standby24x7@gmail.com>,
	netdev@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: Re: [patch] isdn: fix a wrapping bug in isdn_ppp_ioctl()
Date: Wed, 10 Oct 2012 14:05:01 +0200	[thread overview]
Message-ID: <m21uh67csy.fsf@igel.home> (raw)
In-Reply-To: <1349864358.2386.27.camel@joe-AO722> (Joe Perches's message of "Wed, 10 Oct 2012 03:19:18 -0700")

Joe Perches <joe@perches.com> writes:

> @@ -589,16 +589,15 @@ isdn_ppp_ioctl(int min, struct file *file, unsigned int cmd, unsigned long arg)
>  		break;
>  	case PPPIOCGCOMPRESSORS:
>  	{
> -		unsigned long protos[8] = {0,};
> +		DECLARE_BITMAP(protos, BITS_PER_LONG * 8) = { 0, };
>  		struct isdn_ppp_compressor *ipc = ipc_head;
> +
>  		while (ipc) {
> -			j = ipc->num / (sizeof(long) * 8);
> -			i = ipc->num % (sizeof(long) * 8);
> -			if (j < 8)
> -				protos[j] |= (0x1 << i);
> +			if (ipc->num < BITS_PER_LONG * 8)
> +				set_bit(ipc->num, protos);
>  			ipc = ipc->next;
>  		}
> -		if ((r = set_arg(argp, protos, 8 * sizeof(long))))
> +		if ((r = set_arg(argp, protos, sizeof(protos))))

This changes the bit endianess.  Since protos is exported to user space
it is an ABI change.

Andreas.

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

  parent reply	other threads:[~2012-10-10 12:05 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-10  9:42 [patch] isdn: fix a wrapping bug in isdn_ppp_ioctl() Dan Carpenter
2012-10-10  9:42 ` Dan Carpenter
2012-10-10 10:19 ` Joe Perches
2012-10-10 10:19   ` Joe Perches
2012-10-10 10:41   ` Joe Perches
2012-10-10 10:41     ` Joe Perches
2012-10-10 10:42   ` David Laight
2012-10-10 10:42     ` David Laight
2012-10-10 11:15     ` Joe Perches
2012-10-10 11:15       ` Joe Perches
2012-10-10 12:05   ` Andreas Schwab [this message]
2012-10-10 12:05     ` Andreas Schwab
2012-10-10 13:00     ` Joe Perches
2012-10-10 13:00       ` Joe Perches
2012-10-10 13:58       ` Andreas Schwab
2012-10-10 13:58         ` Andreas Schwab
2012-10-10 14:41         ` Joe Perches
2012-10-10 14:41           ` Joe Perches
2012-10-10 14:59           ` David Laight
2012-10-10 14:59             ` David Laight
2012-10-10 15:19             ` Joe Perches
2012-10-10 15:19               ` Joe Perches
2012-10-10 15:44               ` David Laight
2012-10-10 15:44                 ` David Laight
2012-10-10 15:52                 ` Joe Perches
2012-10-10 15:52                   ` Joe Perches
2012-10-12  7:49                   ` Karsten Keil
2012-10-12  7:49                     ` Karsten Keil
2012-10-11  2:46 ` David Miller
2012-10-11  2:46   ` David Miller

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=m21uh67csy.fsf@igel.home \
    --to=schwab@linux-m68k.org \
    --cc=dan.carpenter@oracle.com \
    --cc=davem@davemloft.net \
    --cc=isdn@linux-pingi.de \
    --cc=joe@perches.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=standby24x7@gmail.com \
    /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.