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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxxxx>
> > ---
> >  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

_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/devel


[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux