linux-usb.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] usb: chipidea: udc: initialize bounced_size to avoid coverity warning
@ 2025-01-14 10:28 Xu Yang
  2025-01-17 11:09 ` Greg KH
  0 siblings, 1 reply; 3+ messages in thread
From: Xu Yang @ 2025-01-14 10:28 UTC (permalink / raw)
  To: heikki.krogerus, peter.chen, gregkh; +Cc: linux-usb, imx, jun.li

The synopsys covertiy tool complains "Using uninitialized value
bounced_size." at some condition.

    sg_dma_len(sg) = min(sg_dma_len(sg), bounced_size);
                                         ^~~~~~~~~~~~
Although it can't happen, try remove the warning by initializing it.

Fixes: edfcc455c85c ("usb: chipidea: udc: create bounce buffer for problem sglist entries if possible")
Cc: stable@vger.kernel.org
Signed-off-by: Xu Yang <xu.yang_2@nxp.com>
---
 drivers/usb/chipidea/udc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/chipidea/udc.c b/drivers/usb/chipidea/udc.c
index 8a9b31fd5c89..8e496b7d940d 100644
--- a/drivers/usb/chipidea/udc.c
+++ b/drivers/usb/chipidea/udc.c
@@ -673,7 +673,7 @@ static int _hardware_enqueue(struct ci_hw_ep *hwep, struct ci_hw_req *hwreq)
 	struct ci_hdrc *ci = hwep->ci;
 	int ret = 0;
 	struct td_node *firstnode, *lastnode;
-	unsigned int bounced_size;
+	unsigned int bounced_size = 0;
 	struct scatterlist *sg;
 
 	/* don't queue twice */
-- 
2.34.1


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

* Re: [PATCH] usb: chipidea: udc: initialize bounced_size to avoid coverity warning
  2025-01-14 10:28 [PATCH] usb: chipidea: udc: initialize bounced_size to avoid coverity warning Xu Yang
@ 2025-01-17 11:09 ` Greg KH
  2025-01-20  8:57   ` Xu Yang
  0 siblings, 1 reply; 3+ messages in thread
From: Greg KH @ 2025-01-17 11:09 UTC (permalink / raw)
  To: Xu Yang; +Cc: heikki.krogerus, peter.chen, linux-usb, imx, jun.li

On Tue, Jan 14, 2025 at 06:28:15PM +0800, Xu Yang wrote:
> The synopsys covertiy tool complains "Using uninitialized value
> bounced_size." at some condition.
> 
>     sg_dma_len(sg) = min(sg_dma_len(sg), bounced_size);
>                                          ^~~~~~~~~~~~
> Although it can't happen, try remove the warning by initializing it.

No, we don't work around broken tools, fix the tool, don't abuse our
code for that, sorry.

greg k-h

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

* Re: [PATCH] usb: chipidea: udc: initialize bounced_size to avoid coverity warning
  2025-01-17 11:09 ` Greg KH
@ 2025-01-20  8:57   ` Xu Yang
  0 siblings, 0 replies; 3+ messages in thread
From: Xu Yang @ 2025-01-20  8:57 UTC (permalink / raw)
  To: Greg KH; +Cc: heikki.krogerus, peter.chen, linux-usb, imx, jun.li

On Fri, Jan 17, 2025 at 12:09:29PM +0100, Greg KH wrote:
> On Tue, Jan 14, 2025 at 06:28:15PM +0800, Xu Yang wrote:
> > The synopsys covertiy tool complains "Using uninitialized value
> > bounced_size." at some condition.
> > 
> >     sg_dma_len(sg) = min(sg_dma_len(sg), bounced_size);
> >                                          ^~~~~~~~~~~~
> > Although it can't happen, try remove the warning by initializing it.
> 
> No, we don't work around broken tools, fix the tool, don't abuse our
> code for that, sorry.

Okay. I see.

Thanks,
Xu Yang

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

end of thread, other threads:[~2025-01-20  9:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-01-14 10:28 [PATCH] usb: chipidea: udc: initialize bounced_size to avoid coverity warning Xu Yang
2025-01-17 11:09 ` Greg KH
2025-01-20  8:57   ` Xu Yang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).