From mboxrd@z Thu Jan 1 00:00:00 1970 Return-path: Received: from merlin.infradead.org ([205.233.59.134]:43579 "EHLO merlin.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751112AbcGMKcZ (ORCPT ); Wed, 13 Jul 2016 06:32:25 -0400 Date: Wed, 13 Jul 2016 12:31:37 +0200 From: Peter Zijlstra To: Chris Wilson Cc: linux-kernel@vger.kernel.org, Sumit Semwal , Shuah Khan , Tejun Heo , Daniel Vetter , Andrew Morton , Ingo Molnar , Kees Cook , Thomas Gleixner , "Paul E. McKenney" , Dan Williams , Andrey Ryabinin , Davidlohr Bueso , Nikolay Aleksandrov , "David S. Miller" , Rasmus Villemoes , Andy Shevchenko , Dmitry Vyukov , Alexander Potapenko , linux-media@vger.kernel.org, dri-devel@lists.freedesktop.org, linaro-mm-sig@lists.linaro.org Subject: Re: [PATCH 3/9] async: Extend kfence to allow struct embedding Message-ID: <20160713103137.GB30921@twins.programming.kicks-ass.net> References: <1466759333-4703-1-git-send-email-chris@chris-wilson.co.uk> <1466759333-4703-4-git-send-email-chris@chris-wilson.co.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1466759333-4703-4-git-send-email-chris@chris-wilson.co.uk> Sender: linux-media-owner@vger.kernel.org List-ID: On Fri, Jun 24, 2016 at 10:08:47AM +0100, Chris Wilson wrote: > @@ -151,7 +161,11 @@ static void kfence_free(struct kref *kref) > > WARN_ON(atomic_read(&fence->pending) > 0); > > - kfree(fence); > + if (fence->flags) { > + kfence_notify_t fn = (kfence_notify_t)fence->flags; Maybe provide an inline helper for that conversion and also mask out the low bits, just to be careful. You're assuming they're not set here, which seems like a dangerous thing. > + fn(fence); > + } else > + kfree(fence); Also Codingstyle wants braces on both branches if its on one.