From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 911FD2D8387 for ; Thu, 12 Feb 2026 11:44:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770896641; cv=none; b=pjL//tHOCLQ+ci99KWExio5tdS7aUO7T4vy39mKsS3KGO6U3a5LMPBchn1GG2ry9pMzKbvoLLzazoZilFpHqTgmorO3BpQKTC6sOwVIgSPyaAr5tKIpm3NHwYD/xocol1MyX80zUMh6bhgaT4VKxSh+4z1uLQIZH3OMnATG4UIA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770896641; c=relaxed/simple; bh=COqFDVwFejhkDY7wmu6jH5HxN2D2fR2JAI/imf3tAGc=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=J/uWtULHSzMdP0aSD+rRR9X7awvQXVZS9ZszYUifSvMmRa4AzuGfI/e+88Oe3SGEsxKW3Q9kkWXzVypBkX/4KnvRp9r6p+7/K9TX8znF64BDaxmWBVF3cI7Tfb7gMfRZx9zObwBvzBlvQeKAqgK/XG4/4YTndmkheib8XVICQyA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=EK6D7/Ka; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="EK6D7/Ka" Received: by smtp.kernel.org (Postfix) with ESMTPSA id B5F29C4CEF7; Thu, 12 Feb 2026 11:44:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1770896641; bh=COqFDVwFejhkDY7wmu6jH5HxN2D2fR2JAI/imf3tAGc=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=EK6D7/Ka8XrBSIu/NTsdGwCrXQLR6HuWB6bKUuGZMBcxO7hIY/qfyM+7YMPdtY/5W ShbdggaYLBESe5bAu8YLcLj2x7AtFaNcs8twaL1gxhbg6AtYimcHItCeY3zDOm8XQX rbQ+CL3QN/lxy+WA/m5JTSsMhABYqHhwTUivXzDM= Date: Thu, 12 Feb 2026 12:43:57 +0100 From: Greg KH To: "Jose A. Perez de Azpillaga" Cc: greybus-dev@lists.linaro.org, linux-kernel@vger.kernel.org Subject: Re: [greybus-dev] PATCH 1/1: greybus/usb: handle unspecified lengths in hub_control Message-ID: <2026021222-fondue-celtic-0e2a@gregkh> References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: On Wed, Feb 11, 2026 at 11:02:17PM +0100, Jose A. Perez de Azpillaga wrote: > >From 1e099b581fe475905509b9d600015ea2500b8cf8 Mon Sep 17 00:00:00 2001 > From: "Jose A. Perez de Azpillaga" > Date: Wed, 11 Feb 2026 22:54:40 +0100 > Subject: [PATCH] greybus/usb: handle unspecified lengths in hub_control Something went wrong with your email client to include this in the changelog area. Perhaps use git send-email instead? > > Fixes the FIXME in hub_control where response length was not handled correctly. Can you wrap these lines at 72 columns like the editor asks? > > Signed-off-by: Jose A. Perez de Azpillaga > --- > drivers/staging/greybus/usb.c | 16 +++++++++++----- > 1 file changed, 11 insertions(+), 5 deletions(-) > > diff --git a/drivers/staging/greybus/usb.c b/drivers/staging/greybus/usb.c > index 475f24f20cd4..f5f5a4863ddc 100644 > --- a/drivers/staging/greybus/usb.c > +++ b/drivers/staging/greybus/usb.c > @@ -105,8 +105,10 @@ static int hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue, u16 wIndex, > size_t response_size; > int ret; > > - /* FIXME: handle unspecified lengths */ > - response_size = sizeof(*response) + wLength; > + /* Calculate expected response size */ > + response_size = sizeof(*response); > + if (wLength) > + response_size += wLength; How is this handling an unspecified length? > > operation = gb_operation_create(dev->connection, > GB_USB_TYPE_HUB_CONTROL, > @@ -127,9 +129,13 @@ static int hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue, u16 wIndex, > goto out; > > if (wLength) { > - /* Greybus core has verified response size */ > - response = operation->response->payload; > - memcpy(buf, response->buf, wLength); > + size_t actual_size = operation->response->payload_size - sizeof(*response); > + size_t copy_size = min(wLength, actual_size); > + > + if (copy_size) { > + response = operation->response->payload; > + memcpy(buf, response->buf, copy_size); > + } Sorry, but I do not understand this change. How was this tested? thanks, greg k-h