On Fri, Jun 08, 2018 at 03:33:28PM +0300, Dan Carpenter wrote: > Hello Raed Salem, > > The patch ebb6796bd397: "IB/uverbs: Add read counters support" from > May 31, 2018, leads to the following static checker warning: > > drivers/infiniband/core/uverbs_std_types_counters.c:105 ib_uverbs_handler_UVERBS_METHOD_COUNTERS_READ() > error: 'uattr' dereferencing possible ERR_PTR() > > drivers/infiniband/core/uverbs_std_types_counters.c > 83 static int UVERBS_HANDLER(UVERBS_METHOD_COUNTERS_READ)(struct ib_device *ib_dev, > 84 struct ib_uverbs_file *file, > 85 struct uverbs_attr_bundle *attrs) > 86 { > 87 struct ib_counters_read_attr read_attr = {}; > 88 const struct uverbs_attr *uattr; > 89 struct ib_counters *counters = > 90 uverbs_attr_get_obj(attrs, UVERBS_ATTR_READ_COUNTERS_HANDLE); > 91 int ret; > 92 > 93 if (!ib_dev->read_counters) > 94 return -EOPNOTSUPP; > 95 > 96 if (!atomic_read(&counters->usecnt)) > 97 return -EINVAL; > 98 > 99 ret = uverbs_copy_from(&read_attr.flags, attrs, > 100 UVERBS_ATTR_READ_COUNTERS_FLAGS); > 101 if (ret) > 102 return ret; > 103 > 104 uattr = uverbs_attr_get(attrs, UVERBS_ATTR_READ_COUNTERS_BUFF); > ^^^^^^^^^^^^^^^^^^^^^^^ > Does this require error handling? It is the same as before, uverbs_attr_get cannot fail here. We still need to do something sneaky to show to the compiler when it can and cannot fail.. I have some work already toward this goal but got distracted. Jason -- 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