From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753191AbeDJMrT (ORCPT ); Tue, 10 Apr 2018 08:47:19 -0400 Received: from gum.cmpxchg.org ([85.214.110.215]:50908 "EHLO gum.cmpxchg.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753147AbeDJMrS (ORCPT ); Tue, 10 Apr 2018 08:47:18 -0400 Date: Tue, 10 Apr 2018 08:48:44 -0400 From: Johannes Weiner To: Matthew Wilcox Cc: Minchan Kim , Christopher Lameter , Andrew Morton , linux-mm , LKML , Jan Kara , Chris Fries Subject: Re: [PATCH] mm: workingset: fix NULL ptr dereference Message-ID: <20180410124844.GC6334@cmpxchg.org> References: <20180409015815.235943-1-minchan@kernel.org> <20180409024925.GA21889@bombadil.infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180409024925.GA21889@bombadil.infradead.org> User-Agent: Mutt/1.9.4 (2018-02-28) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Apr 08, 2018 at 07:49:25PM -0700, Matthew Wilcox wrote: > @@ -2714,8 +2714,10 @@ static __always_inline void *slab_alloc_node(struct kmem_cache *s, > stat(s, ALLOC_FASTPATH); > } > > - if (unlikely(gfpflags & __GFP_ZERO) && object) > - memset(object, 0, s->object_size); > + if (unlikely(gfpflags & __GFP_ZERO) && object) { > + if (!WARN_ON_ONCE(s->ctor)) > + memset(object, 0, s->object_size); > + } > > slab_post_alloc_hook(s, gfpflags, 1, &object); This looks like a useful check to have. But maybe behind DEBUG_VM?