summaryrefslogtreecommitdiff
path: root/rust/kernel/alloc/kvec/errors.rs
diff options
context:
space:
mode:
authorDavid Laight <david.laight.linux@gmail.com>2025-11-19 22:41:21 +0000
committerBjorn Helgaas <bhelgaas@google.com>2025-11-24 14:37:13 -0600
commite2378e61153afd2afb671ec66a47f34280c20dad (patch)
tree29806122f22f8cd5dd73454f24bffb12a323737d /rust/kernel/alloc/kvec/errors.rs
parent3a8660878839faadb4f1a6dd72c3179c1df56787 (diff)
PCI: Use max() instead of max_t() to ease static analysis
In this code: used_buses = max_t(unsigned int, available_buses, pci_hotplug_bus_size - 1); max_t() casts the 'unsigned long' pci_hotplug_bus_size (either 32 or 64 bits) to 'unsigned int' (32 bits) result type, so there's a potential of discarding significant bits. Instead, use max(a, b), which casts 'unsigned int' to 'unsigned long' and cannot discard significant bits. In this case, pci_hotplug_bus_size is constrained to <= 0xff by pci_setup() so this doesn't fix a bug, but it makes static analysis easier. Signed-off-by: David Laight <david.laight.linux@gmail.com> [bhelgaas: commit log] Signed-off-by: Bjorn Helgaas <bhelgaas@google.com> Link: https://patch.msgid.link/20251119224140.8616-26-david.laight.linux@gmail.com
Diffstat (limited to 'rust/kernel/alloc/kvec/errors.rs')
0 files changed, 0 insertions, 0 deletions