synclink_gt fix size of register value storage
PATCH 1/1 synclink_gt fix size of register value storage
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.
drivers/char/synclink_gt.c +1 -1
@@ -2630,7 +2630,7 @@ static int get_interface(struct slgt_infstatic 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);
Quoted 10 lines · Paul Fulghum
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 <[email protected]>
drivers/char/synclink_gt.c static int get_interface(struct slgt_inf · line 2633
Quoted 5 lines
drivers/char/synclink_gt.c +1
-1@@ -2630,7 +2630,7 @@ static int get_interface(struct slgt_infstatic 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,
Signature · 3 lines
Jiri Slaby www.fi.muni.cz/~xslaby \_.-^-._ [email protected] _.-^-._/ B67499670407CE62ACC8 22A032CC55C339D47A7E
Quoted 4 lines · Jiri Slaby
drivers/char/synclink_gt.c static int get_interface(struct slgt_inf · line 2633
Quoted 2 lines
drivers/char/synclink_gt.c +1
-1-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?
Signature · 2 lines
Paul Fulghum Microgate Systems, Ltd.