Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1642298 > unrolled thread
| Started by | Felipe Balbi <balbi@kernel.org> |
|---|---|
| First post | 2017-05-16 10:20 +0200 |
| Last post | 2017-05-16 18:30 +0200 |
| Articles | 2 — 2 participants |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: [usb-gadget-udc] question about null check after calling phys_to_virt() function Felipe Balbi <balbi@kernel.org> - 2017-05-16 10:20 +0200
Re: [usb-gadget-udc] question about null check after calling phys_to_virt() function "Gustavo A. R. Silva" <garsilva@embeddedor.com> - 2017-05-16 18:30 +0200
| From | Felipe Balbi <balbi@kernel.org> |
|---|---|
| Date | 2017-05-16 10:20 +0200 |
| Subject | Re: [usb-gadget-udc] question about null check after calling phys_to_virt() function |
| Message-ID | <tHFS1-3bj-15@gated-at.bofh.it> |
[Multipart message — attachments visible in raw view] — view raw
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
[toc] | [next] | [standalone]
| From | "Gustavo A. R. Silva" <garsilva@embeddedor.com> |
|---|---|
| Date | 2017-05-16 18:30 +0200 |
| Subject | Re: [usb-gadget-udc] question about null check after calling phys_to_virt() function |
| Message-ID | <tHNwd-7SQ-5@gated-at.bofh.it> |
| In reply to | #1642298 |
Hi Felipe,
Quoting Felipe Balbi <balbi@kernel.org>:
> 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
>
I get it.
Thanks!
--
Gustavo A. R. Silva
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web