lkml.org 
[lkml]   [2017]   [May]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [usb-gadget-udc] question about null check after calling phys_to_virt() function
Date

Hi,

"Gustavo A. R. Silva" <garsilva@embeddedor.com> writes:
> Hello everybody,
>
> While looking into Coverity ID 145958 I ran into the following piece
> of code at drivers/usb/gadget/udc/amd5536udc.c:852:
>
> } else if (i == buf_len) {
> /* first td */
> td = (struct udc_data_dma *)phys_to_virt(
> req->td_data->next);
> td->status = 0;
> } else {
> td = (struct udc_data_dma *)phys_to_virt(last->next);
> td->status = 0;
> }
>
> if (td)
> td->bufptr = req->req.dma + i; /* assign buffer */
> else
> break;
>
> The issue here is that _td_ pointer is being dereferenced before null check.
>
> After searching for calls to phys_to_virt() function, I've noticed
> that is not common at all to test the returned address value.
>
> So either the null check at line 862 is not needed or a null check
> before each td->status = 0; needs to be added.

just remove the previous null check

--
balbi
[unhandled content-type:application/pgp-signature]
\
 
 \ /
  Last update: 2017-05-16 10:12    [W:0.051 / U:0.012 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site