public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] synclink_gt fix size of register value storage
@ 2006-01-17 16:35 Paul Fulghum
  2006-01-18 12:03 ` Jiri Slaby
  0 siblings, 1 reply; 3+ messages in thread
From: Paul Fulghum @ 2006-01-17 16:35 UTC (permalink / raw)
  To: Andrew Morton; +Cc: Linux Kernel Mailing List

Fix incorrect variable size used to hold
register value. This bug might wipe out a portion of the
TCR value when setting the interface options.

Signed-off-by: Paul Fulghum <paulkf@microgate.com>


--- linux-2.6.16-rc1/drivers/char/synclink_gt.c	2006-01-17 09:31:20.000000000 -0600
+++ linux-2.6.16-rc1-mg/drivers/char/synclink_gt.c	2006-01-17 10:22:48.000000000 -0600
@@ -2630,7 +2630,7 @@ static int get_interface(struct slgt_inf
 static int set_interface(struct slgt_info *info, int if_mode)
 {
  	unsigned long flags;
-	unsigned char val;
+	unsigned short val;
 
 	DBGINFO(("%s set_interface=%x)\n", info->device_name, if_mode));
 	spin_lock_irqsave(&info->lock,flags);



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

* Re: [PATCH] synclink_gt fix size of register value storage
  2006-01-17 16:35 [PATCH] synclink_gt fix size of register value storage Paul Fulghum
@ 2006-01-18 12:03 ` Jiri Slaby
  2006-01-18 15:28   ` Paul Fulghum
  0 siblings, 1 reply; 3+ messages in thread
From: Jiri Slaby @ 2006-01-18 12:03 UTC (permalink / raw)
  To: Paul Fulghum; +Cc: Andrew Morton, Linux Kernel Mailing List

Paul Fulghum wrote:
> Fix incorrect variable size used to hold
> register value. This bug might wipe out a portion of the
> TCR value when setting the interface options.
> 
> Signed-off-by: Paul Fulghum <paulkf@microgate.com>
> 
> 
> --- linux-2.6.16-rc1/drivers/char/synclink_gt.c	2006-01-17 09:31:20.000000000 -0600
> +++ linux-2.6.16-rc1-mg/drivers/char/synclink_gt.c	2006-01-17 10:22:48.000000000 -0600
> @@ -2630,7 +2630,7 @@ static int get_interface(struct slgt_inf
>  static int set_interface(struct slgt_info *info, int if_mode)
>  {
>   	unsigned long flags;
> -	unsigned char val;
> +	unsigned short val;
Shouldn't be this u16 rather than ushort?

regards,
-- 
Jiri Slaby         www.fi.muni.cz/~xslaby
\_.-^-._   jirislaby@gmail.com   _.-^-._/
B67499670407CE62ACC8 22A032CC55C339D47A7E

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

* Re: [PATCH] synclink_gt fix size of register value storage
  2006-01-18 12:03 ` Jiri Slaby
@ 2006-01-18 15:28   ` Paul Fulghum
  0 siblings, 0 replies; 3+ messages in thread
From: Paul Fulghum @ 2006-01-18 15:28 UTC (permalink / raw)
  To: Jiri Slaby; +Cc: Andrew Morton, Linux Kernel Mailing List

Jiri Slaby wrote:
>>-	unsigned char val;
>>+	unsigned short val;
> 
> Shouldn't be this u16 rather than ushort?

It could be argued that way.
A quick search of CodingStyle does not
reference the uXX types.

unsigned short is guaranteed to be
at least 16 bits, so no data is lost.
The value is written to the register using
writew(), so no more than 16 bits are used.
Using unsigned short here will always work.

Do you know of a Linux environment where
unsigned short is not 16 bits?

-- 
Paul Fulghum
Microgate Systems, Ltd.

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

end of thread, other threads:[~2006-01-18 15:28 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-01-17 16:35 [PATCH] synclink_gt fix size of register value storage Paul Fulghum
2006-01-18 12:03 ` Jiri Slaby
2006-01-18 15:28   ` Paul Fulghum

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox