All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] usb: Expand buffer size in usb_find_and_bind_driver()
@ 2022-11-26 12:57 Marek Vasut
  2022-11-27 14:35 ` Simon Glass
  0 siblings, 1 reply; 2+ messages in thread
From: Marek Vasut @ 2022-11-26 12:57 UTC (permalink / raw)
  To: u-boot; +Cc: Marek Vasut, Sean Anderson, Simon Glass

The "generic_bus_%x_dev_%x" string which is printed into this buffer
can be up to 34 characters long ("generic_bus_12345678_dev_12345678").
The buffer would be clipped by snprintf() if both %x were at maximum
range. Make sure the buffer is long enough to cover such possibility.

Signed-off-by: Marek Vasut <marex@denx.de>
---
Cc: Sean Anderson <sean.anderson@seco.com>
Cc: Simon Glass <sjg@chromium.org>
---
 drivers/usb/host/usb-uclass.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/host/usb-uclass.c b/drivers/usb/host/usb-uclass.c
index 27e2fc6fcd3..060f3441df0 100644
--- a/drivers/usb/host/usb-uclass.c
+++ b/drivers/usb/host/usb-uclass.c
@@ -557,7 +557,7 @@ static int usb_find_and_bind_driver(struct udevice *parent,
 	struct usb_driver_entry *start, *entry;
 	int n_ents;
 	int ret;
-	char name[30], *str;
+	char name[34], *str;
 	ofnode node = usb_get_ofnode(parent, port);
 
 	*devp = NULL;
-- 
2.35.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] usb: Expand buffer size in usb_find_and_bind_driver()
  2022-11-26 12:57 [PATCH] usb: Expand buffer size in usb_find_and_bind_driver() Marek Vasut
@ 2022-11-27 14:35 ` Simon Glass
  0 siblings, 0 replies; 2+ messages in thread
From: Simon Glass @ 2022-11-27 14:35 UTC (permalink / raw)
  To: Marek Vasut; +Cc: u-boot, Sean Anderson

On Sun, 27 Nov 2022 at 01:58, Marek Vasut <marex@denx.de> wrote:
>
> The "generic_bus_%x_dev_%x" string which is printed into this buffer
> can be up to 34 characters long ("generic_bus_12345678_dev_12345678").
> The buffer would be clipped by snprintf() if both %x were at maximum
> range. Make sure the buffer is long enough to cover such possibility.
>
> Signed-off-by: Marek Vasut <marex@denx.de>
> ---
> Cc: Sean Anderson <sean.anderson@seco.com>
> Cc: Simon Glass <sjg@chromium.org>
> ---
>  drivers/usb/host/usb-uclass.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>

Reviewed-by: Simon Glass <sjg@chromium.org>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-11-26 14:36 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-26 12:57 [PATCH] usb: Expand buffer size in usb_find_and_bind_driver() Marek Vasut
2022-11-27 14:35 ` Simon Glass

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.