From: Radoslaw Zarzynski Date: Tue, 11 Oct 2016 15:34:05 +0000 (+0200) Subject: rgw: protect the {ACCOUNTING,AWS_AUTHv4,RESTFUL}_IO casts with assert. X-Git-Tag: v11.1.0~454^2~7 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=a33462f806b729968dc6fdf8acfc169da3af5523;p=ceph.git rgw: protect the {ACCOUNTING,AWS_AUTHv4,RESTFUL}_IO casts with assert. Signed-off-by: Radoslaw Zarzynski --- diff --git a/src/rgw/rgw_client_io.h b/src/rgw/rgw_client_io.h index 5db0a9f45bfb..82460d0d1021 100644 --- a/src/rgw/rgw_client_io.h +++ b/src/rgw/rgw_client_io.h @@ -213,14 +213,21 @@ public: /* Type conversions to work around lack of req_state type hierarchy matching * (e.g.) REST backends (may be replaced w/dynamic typed req_state). */ static inline rgw::io::RestfulClient* RESTFUL_IO(struct req_state* s) { + assert(dynamic_cast(s->cio) != nullptr); + return static_cast(s->cio); } static inline rgw::io::Accounter* ACCOUNTING_IO(struct req_state* s) { - return dynamic_cast(s->cio); + auto ptr = dynamic_cast(s->cio); + assert(ptr != nullptr); + + return ptr; } static inline RGWRestfulIO* AWS_AUTHv4_IO(struct req_state* s) { + assert(dynamic_cast(s->cio) != nullptr); + return static_cast(s->cio); }