Re: [PATCH] overflow: Add __must_check attribute to check_*() helpers

2020-08-15 Thread Kees Cook
On Thu, Aug 13, 2020 at 08:39:44AM +0200, Rasmus Villemoes wrote: > On 12/08/2020 23.51, Kees Cook wrote: > > Since the destination variable of the check_*_overflow() helpers will > > contain a wrapped value on failure, it would be best to make sure callers > > really did check the return result

Re: [PATCH] overflow: Add __must_check attribute to check_*() helpers

2020-08-13 Thread Rasmus Villemoes
On 13/08/2020 13.23, Matthew Wilcox wrote: > On Wed, Aug 12, 2020 at 02:51:52PM -0700, Kees Cook wrote: >> +/* >> + * Allows to effectively us apply __must_check to a macro so we can have >> + * both the type-agnostic benefits of the macros while also being able to >> + * enforce that the return

Re: [PATCH] overflow: Add __must_check attribute to check_*() helpers

2020-08-13 Thread Matthew Wilcox
On Wed, Aug 12, 2020 at 02:51:52PM -0700, Kees Cook wrote: > +/* > + * Allows to effectively us apply __must_check to a macro so we can have > + * both the type-agnostic benefits of the macros while also being able to > + * enforce that the return value is, in fact, checked. > + */ > +static

Re: [PATCH] overflow: Add __must_check attribute to check_*() helpers

2020-08-13 Thread Rasmus Villemoes
On 12/08/2020 23.51, Kees Cook wrote: > Since the destination variable of the check_*_overflow() helpers will > contain a wrapped value on failure, it would be best to make sure callers > really did check the return result of the helper. Adjust the macros to use > a bool-wrapping static inline

[PATCH] overflow: Add __must_check attribute to check_*() helpers

2020-08-12 Thread Kees Cook
Since the destination variable of the check_*_overflow() helpers will contain a wrapped value on failure, it would be best to make sure callers really did check the return result of the helper. Adjust the macros to use a bool-wrapping static inline that is marked with __must_check. This means the