summaryrefslogtreecommitdiff
path: root/rust/kernel/alloc/allocator
diff options
context:
space:
mode:
authorLianjie Wang <lian@is.s.u-tokyo.ac.jp>2026-11-05 04:56:32 +0900
committerBartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>2026-11-17 09:27:51 +0100
commit9e3032dc4d92e6214ae687b4c474de9270ce74a2 (patch)
treef95049c9566331e953742315ff544e8a8e0ca4b6 /rust/kernel/alloc/allocator
parent74aee8e06277df39ec10ed043bae0ed5b7a83864 (diff)
gpio: virtio: compute the line names size in a size_t
virtio_gpio_get_names() computes the size of the GET_LINE_NAMES response as sizeof(*res) + gpio_names_size in an int, where gpio_names_size is a u32 from the config space. A gpio_names_size of 0xffffffff makes the size 0, devm_kzalloc() returns ZERO_SIZE_PTR, and reading the status byte of the response through it oopses: Oops: general protection fault, probably for non-canonical address 0xdffffc0000000002: 0000 [#1] SMP KASAN PTI KASAN: null-ptr-deref in range [0x0000000000000010-0x0000000000000017] RIP: 0010:_virtio_gpio_req+0x2b8/0x550 Call Trace: virtio_gpio_probe+0xc2a/0xfc0 virtio_dev_probe+0xa7a/0xc50 Compute the size with struct_size() into a size_t. Fixes: 3a29355a22c0 ("gpio: Add virtio-gpio driver") Cc: stable@vger.kernel.org Signed-off-by: Lianjie Wang <lian@is.s.u-tokyo.ac.jp> Acked-by: Viresh Kumar <viresh.kumar@linaro.org> Link: https://patch.msgid.link/20261104195632.1702765-2-lian@is.s.u-tokyo.ac.jp Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
Diffstat (limited to 'rust/kernel/alloc/allocator')
0 files changed, 0 insertions, 0 deletions