aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/infiniband/core/netlink.c
diff options
context:
space:
mode:
authorMark Bloch <markb@mellanox.com>2016-05-06 22:45:25 +0300
committerDoug Ledford <dledford@redhat.com>2016-05-13 19:40:01 -0400
commit1ae5ccc78105490cd1f73bdf4847e7c6d03f0aa1 (patch)
treef7ec91aca1a3518cb305abcb803e8f7943b939e7 /drivers/infiniband/core/netlink.c
parentIB/IWPM: Fix a potential skb leak (diff)
downloadlinux-dev-1ae5ccc78105490cd1f73bdf4847e7c6d03f0aa1.tar.xz
linux-dev-1ae5ccc78105490cd1f73bdf4847e7c6d03f0aa1.zip
IB/core: Remove unnecessary check in ibnl_rcv_msg
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>
Diffstat (limited to 'drivers/infiniband/core/netlink.c')
-rw-r--r--drivers/infiniband/core/netlink.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/drivers/infiniband/core/netlink.c b/drivers/infiniband/core/netlink.c
index d47df9356779..9b8c20c8209b 100644
--- a/drivers/infiniband/core/netlink.c
+++ b/drivers/infiniband/core/netlink.c
@@ -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;
/*