denc nullptr issue

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



We have three competing PRs to address the crashes when -O0 is used:

lixiaoy1	https://github.com/ceph/ceph/pull/12796
kefu		https://github.com/ceph/ceph/pull/13819
adam		https://github.com/ceph/ceph/pull/12931

Adam's is appealing because it will ensure the bounded encodes are in fact 
constant at compile time.  Unfortunately, it requires you to define DENC 
twice, like so:

-  DENC_FEATURED(bar_t, v, p, f) {
+  DENC_FEATURED_BOUNDED(bar_t, v, p, f) {
     ::denc(v.a, p, f);
     ::denc(v.b, p, f);
   }
+  DENC_FEATURED_BOUND_ENCODE(bar_t, p, f) {
+    DENC_START(1, 1, p);
+    ::denc(bounded_t<decltype(bar_t::a)>{}, p, f);
+    ::denc(bounded_t<decltype(bar_t::b)>{}, p, f);
+    DENC_FINISH(p);
+  }

which feels like a deal-killer to me... I think I'd rather just drop the 
check entirely and rely on the developer to be careful.

The other two PRs fix up the handful of type(s) that were actually causing 
failures to manually define bound (again making the single DENC macro 
unusable).

What about instead changing all of the instances of

      denc(*(const T*)nullptr, elem_size);

with a macro that will either do the above "*(const T*)nullptr" -or-, if 
it looks like this is a debug build or compiler optimizations are off or 
some other compiler environment indicates it won't work, replace it with 
"T()"?  That avoids crashes in the -O0 case, but still lets us keep some 
safeguard for other builds?

Any other ideas?

sage

--
To unsubscribe from this list: send the line "unsubscribe ceph-devel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [CEPH Users]     [Ceph Large]     [Information on CEPH]     [Linux BTRFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux