From: Changcheng Liu Date: Thu, 25 Apr 2019 05:02:29 +0000 (+0800) Subject: msg/async/rdma: check allocated memory immediately before using it X-Git-Tag: v15.1.0~2831^2~2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=09c9fa11acb5ed051c6269cf51ffe99b5eb9fe67;p=ceph.git msg/async/rdma: check allocated memory immediately before using it 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 --- diff --git a/src/msg/async/rdma/Infiniband.h b/src/msg/async/rdma/Infiniband.h index d904ad7d11b..76122300376 100644 --- a/src/msg/async/rdma/Infiniband.h +++ b/src/msg/async/rdma/Infiniband.h @@ -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];