]> git.ipfire.org Git - thirdparty/iproute2.git/commit
rdma: Don't allocate sparse array
authorLeon Romanovsky <leonro@nvidia.com>
Sun, 9 Jan 2022 18:41:39 +0000 (20:41 +0200)
committerDavid Ahern <dsahern@kernel.org>
Tue, 11 Jan 2022 16:19:27 +0000 (09:19 -0700)
commitbb4cc9cca40850370c1fe5ba79b3f7f186f379f1
tree5d34a41f04385f881d43ab84e2c04ede16e01652
parentb87671681e8aa9318e30c4e646419d96f1063d23
rdma: Don't allocate sparse array

The addition of driver QP type with index 0xFF caused to the following
clang compilation error:

res.c:152:10: warning: result of comparison of constant 256 with expression of type 'uint8_t' (aka 'unsigned char') is always true [-Wtautological-constant-out-of-range-compare]
        if (idx < ARRAY_SIZE(qp_types_str) && qp_types_str[idx])
            ~~~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~

Instead of allocating very sparse array, simply create separate check
for the driver QP type.

Fixes: 39307384cea7 ("rdma: Add driver QP type string")
Reported-by: Stephen Hemminger <stephen@networkplumber.org>
Signed-off-by: Leon Romanovsky <leonro@nvidia.com>
Signed-off-by: David Ahern <dsahern@kernel.org>
rdma/res.c