summaryrefslogtreecommitdiff
path: root/scripts/dummy-tools/python3
diff options
context:
space:
mode:
authorMaoyi Xie <maoyixie.tju@gmail.com>2026-05-21 14:54:28 +0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2026-05-22 11:36:01 +0200
commite2ffaac1884b921b8ec2b3a964c6a8b5d610bf4b (patch)
tree1919a5eb81826c6d3121ddf281f2459e70863b66 /scripts/dummy-tools/python3
parent52c9780404963fea7300a7517ef1290439a1e08b (diff)
usb: gadget: aspeed_udc: avoid past-the-end iterator in dequeue
ast_udc_ep_dequeue() declares the loop cursor `req` outside the list_for_each_entry(). After the loop it tests `&req->req != _req` to decide whether the request was found. If the queue holds no match, `req` is past-the-end. It then aliases container_of(&ep->queue, struct ast_udc_request, queue) via offset cancellation. Whether that synthetic address equals `_req` depends on heap layout. The function can return 0 without dequeueing anything. Default `rc` to -EINVAL and set it to 0 only inside the match branch. `req` is no longer read after the loop, so the past-the-end dereference goes away. No extra cursor variable or post-loop test is needed. Suggested-by: Alan Stern <stern@rowland.harvard.edu> Suggested-by: Andrew Jeffery <andrew@codeconstruct.com.au> Signed-off-by: Maoyi Xie <maoyixie.tju@gmail.com> Link: https://patch.msgid.link/20260521065428.3261238-1-maoyixie.tju@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'scripts/dummy-tools/python3')
0 files changed, 0 insertions, 0 deletions