RE: [PATCH rdma-next 2/4] IB/core: Remove unnecessary check in ibnl_rcv_msg

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




> -----Original Message-----
> From: linux-rdma-owner@xxxxxxxxxxxxxxx [mailto:linux-rdma-
> owner@xxxxxxxxxxxxxxx] On Behalf Of Leon Romanovsky
> Sent: Wednesday, May 04, 2016 12:36 AM
> To: dledford@xxxxxxxxxx
> Cc: linux-rdma@xxxxxxxxxxxxxxx; markb@xxxxxxxxxxxx; majd@xxxxxxxxxxxx;
> matanb@xxxxxxxxxxxx; Leon Romanovsky
> Subject: [PATCH rdma-next 2/4] IB/core: Remove unnecessary check in
> ibnl_rcv_msg
> 
> From: Mark Bloch <markb@xxxxxxxxxxxx>
> 
> 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@xxxxxxxxxxxx>
> Signed-off-by: Leon Romanovsky <leon@xxxxxxxxxx>
> ---
>  drivers/infiniband/core/netlink.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/drivers/infiniband/core/netlink.c
b/drivers/infiniband/core/netlink.c
> index d47df93..aa491f7 100644
> --- a/drivers/infiniband/core/netlink.c
> +++ b/drivers/infiniband/core/netlink.c
> @@ -155,8 +155,7 @@ static int ibnl_rcv_msg(struct sk_buff *skb, struct
nlmsghdr
> *nlh)
> 
>  	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;
> 
>  			/*

Should op be made unsigned as well?  That would make it clearer.

Steve.


--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Photo]     [Yosemite News]     [Yosemite Photos]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux