From: xie xingguo Date: Sat, 1 Jul 2017 03:48:37 +0000 (+0800) Subject: crush: fix error handling X-Git-Tag: v12.1.1~42^2~7 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=c05bff87df9788867ee4d1982235fdfe5eb46483;p=ceph.git crush: fix error handling get_bucket() does not return a nullptr on error, it returns a negative error code instead. Use the IS_ERR() macro to handle it properly. Signed-off-by: xie xingguo --- diff --git a/src/crush/CrushWrapper.cc b/src/crush/CrushWrapper.cc index 1f4b3f52193..012a065fbdc 100644 --- a/src/crush/CrushWrapper.cc +++ b/src/crush/CrushWrapper.cc @@ -1596,7 +1596,7 @@ int CrushWrapper::device_class_clone(int original_id, int device_class, int *clo return 0; } crush_bucket *original = get_bucket(original_id); - if (original == NULL) + if (IS_ERR(original)) return -ENOENT; crush_bucket *copy = crush_make_bucket(crush, original->alg,