Hi, > -----Original Message----- > From: David Laight [mailto:David.Laight@xxxxxxxxxx] > Sent: Thursday, March 13, 2014 5:29 PM > To: Krzysztof Opasiak; mporter@xxxxxxxxxx; linux- > usb@xxxxxxxxxxxxxxx > Cc: Andrzej Pietrasiewicz; Karol Lewandowski; Stanislaw Wadas; > ty317.kim@xxxxxxxxxxx; Marek Szyprowski; Robert Baldyga > Subject: RE: [PATCH 3/6] libusbg: Remove fixed-size buffers from > usbg_config. > > From: Krzysztof Opasiak > > Path and name length should not be placed in constant > > size buffer but in allocated memory. > > > > Use also PATH_MAX macro from limits.h instead of internal > > library macro. > > There might be some sense in keeping USBG_MAX_PATH_LENGTH > but defaulting to PATH_MAX. When I'm thinking about it now, I agree that there is some sense in keeping it to provide convenient method to make it easily modifiable. > > ... > > - char cpath[USBG_MAX_PATH_LENGTH]; > > + char cpath[PATH_MAX]; > > > > - sprintf(cpath, "%s/%s/%s", path, g->name, CONFIGS_DIR); > > + n = snprintf(cpath, PATH_MAX, "%s/%s/%s", path, g->name, > CONFIGS_DIR); > > Use 'sizeof (path)' then it doesn't matter which literal is used > when the array is allocated. > Right, it makes a sense to use this instead of writing two times same macro. Thank you David for your remarks. All issues will be fixed in v2. -- BR's Krzysztof Opasiak Samsung R&D Institute Poland Samsung Electronics k.opasiak@xxxxxxxxxxx -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html