IB/core: Remove unnecessary check in ibnl_rcv_msg
authorMark Bloch <markb@mellanox.com>
Fri, 6 May 2016 19:45:25 +0000 (22:45 +0300)
committerDoug Ledford <dledford@redhat.com>
Fri, 13 May 2016 23:40:01 +0000 (19:40 -0400)
RDMA_NL_GET_OP is defined like this: (type & ((1 << 10) - 1))
which means op (defined as an int) can never be a negative number.

Fixes: b2cbae2c2487 ('RDMA: Add netlink infrastructure')
Signed-off-by: Mark Bloch <markb@mellanox.com>
Reviewed-by: Leon Romanovsky <leonro@mellanox.com>
Signed-off-by: Leon Romanovsky <leon@kernel.org>
Signed-off-by: Doug Ledford <dledford@redhat.com>
drivers/infiniband/core/netlink.c

index d47df935677966b6b8ceaf3217036ee8a16f4507..9b8c20c8209bcfa6deb62a20a1f598592e4b7f9b 100644 (file)
@@ -151,12 +151,11 @@ static int ibnl_rcv_msg(struct sk_buff *skb, struct nlmsghdr *nlh)
        struct ibnl_client *client;
        int type = nlh->nlmsg_type;
        int index = RDMA_NL_GET_CLIENT(type);
-       int op = RDMA_NL_GET_OP(type);
+       unsigned int op = RDMA_NL_GET_OP(type);
 
        list_for_each_entry(client, &client_list, list) {
                if (client->index == index) {
-                       if (op < 0 || op >= client->nops ||
-                           !client->cb_table[op].dump)
+                       if (op >= client->nops || !client->cb_table[op].dump)
                                return -EINVAL;
 
                        /*