]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
msg/async/rdma: check allocated memory immediately before using it
authorChangcheng Liu <changcheng.liu@intel.com>
Thu, 25 Apr 2019 05:02:29 +0000 (13:02 +0800)
committerChangcheng Liu <changcheng.liu@intel.com>
Thu, 25 Apr 2019 06:08:00 +0000 (14:08 +0800)
The new "allocation functions" will through exception if it failes to
allocate space. There's no need to assert(devices) here for every
get_device operation.
Refer to: https://en.cppreference.com/w/cpp/memory/new/bad_alloc

Signed-off-by: Changcheng Liu <changcheng.liu@intel.com>
src/msg/async/rdma/Infiniband.h

index d904ad7d11b80e5992393cdace4ced21d383a037..76122300376b5c678c6ea0318b35ff41a38096a0 100644 (file)
@@ -121,7 +121,6 @@ class DeviceList {
   }
 
   Device* get_device(const char* device_name) {
-    ceph_assert(devices);
     for (int i = 0; i < num; ++i) {
       if (!strlen(device_name) || !strcmp(device_name, devices[i]->get_name())) {
         return devices[i];