Message ID | 20250114102815.2311956-1-xu.yang_2@nxp.com (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | usb: chipidea: udc: initialize bounced_size to avoid coverity warning | expand |
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
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
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 */
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(-)