[PATCH] Staging: speakup: fix an improperly-declared variable.

Dan Carpenter dan.carpenter at oracle.com
Sun Jun 17 17:34:33 UTC 2012


On Sun, Jun 17, 2012 at 07:27:47PM +0300, Dan Carpenter wrote:
> On Sat, Jun 16, 2012 at 04:55:20PM -0500, Christopher Brannon wrote:
> > A local static variable was declared as a pointer to a string
> > constant.  We're assigning to the underlying memory, so it
> > needs to be an array instead.
> > 
> > Signed-off-by: Christopher Brannon <chris at the-brannons.com>
> > ---
> >  drivers/staging/speakup/main.c |    2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/drivers/staging/speakup/main.c b/drivers/staging/speakup/main.c
> > index 92b34e2..40e2488 100644
> > --- a/drivers/staging/speakup/main.c
> > +++ b/drivers/staging/speakup/main.c
> > @@ -1854,7 +1854,7 @@ static void speakup_bits(struct vc_data *vc)
> >  
> >  static int handle_goto(struct vc_data *vc, u_char type, u_char ch, u_short key)
> >  {
> > -	static u_char *goto_buf = "\0\0\0\0\0\0";
> > +	static u_char goto_buf[8];
> >  	static int num;
> >  	int maxlen, go_pos;
> >  	char *cp;
> 
> I don't understand what the code is doing here (although it's
> handling something obviously).  In the original the memory was
> initialized to zero, so shouldn't the new code do that as well?

Oh.  It's static.  Never mind.  Sorry for the noise.

regards,
dan carpenter




More information about the devel mailing list