Re: [PATCH v3 1/2] staging: speakup: reuse native hex2bin()

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

 



On Tue, 2013-04-09 at 17:38 +0200, Samuel Thibault wrote: 
> Andy Shevchenko, le Tue 09 Apr 2013 15:22:15 +0300, a écrit :
> > @@ -349,21 +349,8 @@ char *spk_xlate(char *s)
> >  				num = (*p1++)&7;
> >  			}
> >  			*p++ = num;
> > -		} else if (*p1 == 'x' &&
> > -				strchr(hx, p1[1]) && strchr(hx, p1[2])) {
> ...
> > +		} else if (*p1 == 'x' && !hex2bin(&num, p1 + 1, 1)) {
> > +			p1 += 3;
> 
> Checking it again, I realize that this does not check p1[1]!=0 and
> p1[2]!=0 any more ; it has to because hex2bin does not perform the
> check (and could thus erroneously dereference p1[2]).

Good point.

I don't remember the reason why hex2bin goes to do one check instead of
two, but here we could apply one check more or do something better. Let
me think a bit.

-- 
Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx>
Intel Finland Oy
_______________________________________________
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