Received: by 10.213.65.68 with SMTP id h4csp3857827imn; Tue, 10 Apr 2018 05:52:18 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/UQBBOHFOTJnlUDvEI0z+U69dTB9dLmJV0I9C2HQuHfh0TEKjVMHLywgwCZfxHrsoOzdbm X-Received: by 2002:a17:902:8e8a:: with SMTP id bg10-v6mr272493plb.329.1523364738423; Tue, 10 Apr 2018 05:52:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523364738; cv=none; d=google.com; s=arc-20160816; b=iezW1imkLjOlGPrc/etLUF6iKHCniWe4RaVIKcBMI3qTxnvg19U/8gODan/FQKO1xr PaKMmK0vf2/YAf84tahNW+wMnt1wACXsInpXSwFFT+c+p4bR4V5Ko19JMTetqOd7ioB+ a8TO6yEU0Snj0ZNYjLazYkL9eNzmJ/fVXB++dFzX9F2U/+KuSIQ4ZVgqgocC3OMcinS3 7MksJlcdylJuWLh1c/tjdzHOAy17fIW+qzr3SueydgiwIM9VkznmM3/sRh3QtHCsWbPM TrKczfU394m0rgyWFV2/s40QvvzWW2nlIEGcxSrCzzDu9zHDuTT5c/B7I4lwjDwAhrGs 0dFw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:arc-authentication-results; bh=cFOe3yarUPfbxwX+GFMqHzefMXNQJTNHGEzBVqRwp40=; b=gCgggBihPeS8UZZwqr3MY3gJ8r1UWQXE6NgtxD8Z4tTvDbQ1JnRsjWunevaxtLSRHA HLE6ZDFsI8ffOnIdd3zsttVHD7iVuqpt7Tmo1CKgSzjtsU15WuHZpo+9SxWHzv7431Fp 8adMFSPyIrkG6PhRv4qKjcAWHJtv1NLaZS6eYwvmLfxUb8DixwdmDZWHlCuEoWxb8Gzk P3aoq69Zgtxq3vR5Ax16IMloVpjbZD2HsOnsUZDVmTqLAJDBZtLKMB2pLpYahRq9Xwp3 zpc7sKpjBTikYE+VsswDb9F0EdsLkWGWRIFID/iEyppAcG8pu3wzDYx5c9268QYD2Dtf 2GIQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@cmpxchg.org header.s=x header.b=LqhFUS51; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=cmpxchg.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s8-v6si2843923plk.550.2018.04.10.05.51.41; Tue, 10 Apr 2018 05:52:18 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@cmpxchg.org header.s=x header.b=LqhFUS51; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=cmpxchg.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753185AbeDJMrT (ORCPT + 99 others); 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 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=cmpxchg.org ; s=x; h=In-Reply-To:Content-Type:MIME-Version:References:Message-ID:Subject: Cc:To:From:Date:Sender:Reply-To:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=cFOe3yarUPfbxwX+GFMqHzefMXNQJTNHGEzBVqRwp40=; b=LqhFUS51Te3J6BuGkdWK+2KH+6 gpVeb3mmruqf23kF4Bcvr1yoJ9E8/QM5uCcY8iLYWKVe971QGIbhN5yaE7gua4b4kibEofz1MIBIf WMXTwuIADm93l/mDPykR1y5DiVOovCw5M9SpiCdMoyQlKUJPwiQY+pzX8Tg1UiA3S5xY=; 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 Precedence: bulk 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?