usb: udc: Make tracing aware that usb_ep_alloc_request() can return NULL
PATCH 1/1 usb: udc: Make tracing aware that usb_ep_alloc_request() can return NULL
The alloc_request callback of the EP can return NULL if it was not able to allocate a request. This NULL pointer will then be dereferenced by tracing in order to show details about it.
Let tracing check the req pointer and if NULL just write 0.
Fixes 5e42d710a108c ("usb: gadget: add tracepoints to the gadget API")
Reported-by [email protected]
Signed-off-by Sebastian Andrzej Siewior <[email protected]>
--- drivers/usb/gadget/udc/trace.h | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-)
drivers/usb/gadget/udc/trace.h +9 -9
@@ -239,15 +239,15 @@ DECLARE_EVENT_CLASS(udc_log_req, ), TP_fast_assign( __assign_str(name); - __entry->length = req->length; - __entry->actual = req->actual; - __entry->num_sgs = req->num_sgs; - __entry->num_mapped_sgs = req->num_mapped_sgs; - __entry->stream_id = req->stream_id; - __entry->no_interrupt = req->no_interrupt; - __entry->zero = req->zero; - __entry->short_not_ok = req->short_not_ok; - __entry->status = req->status; + __entry->length = req ? req->length :0 ; + __entry->actual = req ? req->actual :0 ; + __entry->num_sgs = req ? req->num_sgs :0 ; + __entry->num_mapped_sgs = req ? req->num_mapped_sgs :0 ; + __entry->stream_id = req ? req->stream_id :0 ; + __entry->no_interrupt = req ? req->no_interrupt :0 ; + __entry->zero = req ? req->zero :0 ; + __entry->short_not_ok = req ? req->short_not_ok :0 ; + __entry->status = req ? req->status :0 ; __entry->ret = ret; __entry->req = req; ),
Signature · 1 line
2.55.0