Skip to contentSkip to conversation

IB/cma: Add default RoCE TOS to CMA configfs

bug report Dan Carpenter 3 participants 3 messages Jan 31, 2017 1 message not in the archive InfiniBand

lore
Share & tools
lore
#0 lore raw

Hello Majd Dibbiny,

The patch eeec11e5c404: "IB/cma: Add default RoCE TOS to CMA configfs" from Dec 19, 2016, leads to the following static checker warning:

drivers/infiniband/core/cma.c:303 cma_get_default_roce_tos()
warn: signedness bug returning '(-22)'

drivers/infiniband/core/cma.c
298
299 u8 cma_get_default_roce_tos(struct cma_device *cma_dev, unsigned int port) 300 {
301 if (port < rdma_start_port(cma_dev->device) ||
302 port > rdma_end_port(cma_dev->device))
303 return -EINVAL;

This is a u8 function so you can't return negative error codes.

   304  
   305          return cma_dev->default_roce_tos[port - rdma_start_port(cma_dev->device)];
   306  }
   307  

regards,
dan carpenter
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

#1 lore raw
Quoted 4 lines · Dan Carpenter

Hello Majd Dibbiny,

Hello Daniel,

Thanks for the report.
I'll fix and send a new revision soon..

Quoted 18 lines

The patch eeec11e5c404: "IB/cma: Add default RoCE TOS to CMA configfs" from Dec 19, 2016, leads to the following static checker warning:

drivers/infiniband/core/cma.c:303 cma_get_default_roce_tos()
warn: signedness bug returning '(-22)'

drivers/infiniband/core/cma.c
298
299 u8 cma_get_default_roce_tos(struct cma_device *cma_dev, unsigned int port) 300 {
301 if (port < rdma_start_port(cma_dev->device) ||
302 port > rdma_end_port(cma_dev->device))
303 return -EINVAL;

This is a u8 function so you can't return negative error codes.

Quoted 7 lines
  304  
  305          return cma_dev->default_roce_tos[port - rdma_start_port(cma_dev->device)];
  306  }
  307  

regards,
dan carpenter

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

A message that is not in the archive (sent off-list or not yet received): 01D1013C-F14B-467D-A21E-9EA6214A38F5-VPRAkNaXOzVWk0Htik3J/[email protected]

#3 lore raw
Quoted 8 lines · Majd Dibbiny
Quoted 4 lines · Dan Carpenter

Hello Majd Dibbiny,

Hello Daniel,

Thanks for the report.
I'll fix and send a new revision soon..

Can you re-base it on top of for-next and use the new inline function rdma_is_port_valid?

Quoted 24 lines
Quoted 24 lines

The patch eeec11e5c404: "IB/cma: Add default RoCE TOS to CMA configfs" from Dec 19, 2016, leads to the following static checker warning:

drivers/infiniband/core/cma.c:303 cma_get_default_roce_tos()
warn: signedness bug returning '(-22)'

drivers/infiniband/core/cma.c
298
299 u8 cma_get_default_roce_tos(struct cma_device *cma_dev, unsigned int port) 300 {
301 if (port < rdma_start_port(cma_dev->device) ||
302 port > rdma_end_port(cma_dev->device))
303 return -EINVAL;

This is a u8 function so you can't return negative error codes.

  304  
  305          return cma_dev->default_roce_tos[port - rdma_start_port(cma_dev->device)];
  306  }
  307  
Quoted 6 lines
Quoted 2 lines

regards,
dan carpenter

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

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