usb: f_mass_storage: Bump local buffer size in fsg_common_create_luns()
PATCH v2 1/1 usb: f_mass_storage: Bump local buffer size in fsg_common_create_luns()
GCC (Debian 14.2.0-19) is not happy about the buffer size:
drivers/usb/gadget/function/f_mass_storage.c:2970:48: error: ‘%d’ directive output may be truncated writing between 1 and 9 bytes into a region of size 5 [-Werror=format-truncation=]
Bump the size to get it enough for all possible values.
Note, although cfg->nluns is limited to FSG_MAX_LUNS (16), the compiler doesn't realize this and complains about the buffer size.
Also note, the existing comment is wrong as size 8 for the whole buffer doesn't cover 100 mil numbers, hence drop it altogether.
Fixes b27c08c953e9 ("usb: gadget: f_mass_storage: create lun creation helpers for use in fsg_common_init")
Acked-by Alan Stern <[email protected]>
Signed-off-by Andy Shevchenko <[email protected]>
---
v2: elaborated chosen approach in the commit message (Alan), added tag (Alan)
drivers/usb/gadget/function/f_mass_storage.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/gadget/function/f_mass_storage.c +1 -1
@@ -2961,7 +2961,7 @@ EXPORT_SYMBOL_GPL(fsg_common_create_lun);int fsg_common_create_luns (struct fsg_common *common,struct fsg_config *cfg) { -char buf[8 ];/* enough for 100000000 different numbers, decimal */ +char buf[14 ];int i, rc;fsg_common_remove_luns (common);
Signature · 1 line
2.50.1