Re: staging: visorchannel module

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

 



On Fri, Mar 07, 2014 at 11:38:03AM +0300, Dan Carpenter wrote:
> Hello Ken Cox,
> 
> The patch e423812a9e43: "staging: visorchannel module" from Mar 4,
> 2014, leads to the following Smatch warning:
> 
> 	drivers/staging/unisys/include/guidutils.h:60 GUID_format2()
> 	error: format string overflow. buf_size: 50 length: 63
> 
> drivers/staging/unisys/include/guidutils.h
>     57  static inline char *
>     58  GUID_format2(const GUID *guid, char *s)
>     59  {
>     60          sprintf(s, "{%-8.8lx-%-4.4x-%-4.4x-%-2.2x%-2.2x-%-2.2x%-2.2x%-2.2x%-2.2x%-2.2x%-2.2x}",
>     61                  (ulong) guid->data1,
>     62                  guid->data2,
>     63                  guid->data3,
>     64                  guid->data4[0],
>     65                  guid->data4[1],
>     66                  guid->data4[2],
>     67                  guid->data4[3],
>     68                  guid->data4[4], guid->data4[5], guid->data4[6], guid->data4[7]);
>     69          return s;
>     70  }
> 
> The 50 character buf size comes from the CHANNEL_GUID_MISMATCH() macros.
> I'm not sure how it's calculating that it takes 63 characters.  printf
> formats make my head hurt.  My test said the max was 95 characters?

There should be a built-in guid printk() macro (or function to do it)
already in the kernel, so this code should be able to just be deleted
entirely.

thanks,

greg k-h
_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-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