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?

You would need to have Smatch's cross function db set up to see this
error message.  But there might be useful stuff without the cross
function db.  Give it a whirl.

regards,
dan carpenter
_______________________________________________
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

Reply via email to