Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp9389002ybi; Wed, 24 Jul 2019 03:15:36 -0700 (PDT) X-Google-Smtp-Source: APXvYqzbczziBvoT/hZlMBPYpa5xK8OwQB9bVeLOVfDyeor+85CAiTWRxykOxzY/jxOyV7tAxzKC X-Received: by 2002:a17:902:968c:: with SMTP id n12mr89241848plp.59.1563963336064; Wed, 24 Jul 2019 03:15:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1563963336; cv=none; d=google.com; s=arc-20160816; b=oE92i+DX1TAu9JyxE5GcYESgoOJa6AJjhDFiZ8du8oVa10NLaEXdNsjIAat3wkVYvb rgVFIZbUAGdFNCsChJxEFVVsd2+Y0LJBGXO7m/thCrEynW7/JpJbAHl1kmcv5YF4OXuE sj0mRZtg8M6BOE2pA608jfQjqWSzpoN5PTvQok91gnb/ZEC7hvNE9I/6xznCaggWVm52 mRouqI7XUnZfMQSjlRPbv/jxRCvqsCRfHbWas7Asq5l6xbHhv9L92y7lDrYPBu7a3kkO tMpHnyysZ5Kl1/Z44yLrF8dnFuWgDOBRyyc7KHA/9t88VxKHWM/m+IgnfneFPAhUuh3W rT4Q== 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; bh=/MAFxUXpNzbi4KjfrTLt3NyDxXRqZOCjaS3pKnzg3rU=; b=eXQfC/nnRTwDVJ/qMwDVCg1Uvw8fbO3ap60SQ82igEPyjCqYxCRu/wdQrR4IrjUyFK HsYC8RzhXPnpJt+wRW2jlF2yS5+YNt7C36+dYRdzqt9YimctjVKuD4DKz1hz8SNyR/k2 hZJ0BgjZeajez2Z5ABcW9OVKbfZJHpyJMVHVMPVP4dZRM+F3f7umVMFfthkjqowCparH 5vvvF0ne9c9wrDKlsI2Smjw85ckT3i0fxzqVTPz/CE+DB19kBxglRqtMT3Y7Srna2T+j Gftu9k5kXx+C47yrbzwC2/tRsMr+9apaVFFoKKIiIkOS57iN/XkRhqD9GH4cBs7r1fmy /hRg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=ZZcd7Ka0; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u7si3351479pgc.460.2019.07.24.03.15.16; Wed, 24 Jul 2019 03:15:36 -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=@infradead.org header.s=bombadil.20170209 header.b=ZZcd7Ka0; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726817AbfGXKAc (ORCPT + 99 others); Wed, 24 Jul 2019 06:00:32 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:40254 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726300AbfGXKAc (ORCPT ); Wed, 24 Jul 2019 06:00:32 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; 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=/MAFxUXpNzbi4KjfrTLt3NyDxXRqZOCjaS3pKnzg3rU=; b=ZZcd7Ka0dorUDDVUfi1UN4o90 ehVjn6m3vk7MR8Ua7fhH+bVC3Zlb1KGryiDONAa8oLUk8nB9/sTDkh0Y2kNacQmbcSIm2TBnySXRr okBBjJe5S4tOwVJxq07I/I/BvjqhYxDmsXxaAorTlC6dAUG3Bg/DbcKevXJn12r+6/7THzEVZ/Sem V9pwTBvi1nvgWUPttOJLeOwhK/aZphrhxqjXRjPN5FNtxHfTbfuxNRAmbtqWh7SG0lPzgsIj46zY3 J2pwtxrHDmAIyWdEwrswzselJRaRh4Cy5Ad05+oNkzxyD9g614WCLy/SWJ0LElxfuWAfzLCZmEeVu 5lsXZ0jEQ==; Received: from hch by bombadil.infradead.org with local (Exim 4.92 #3 (Red Hat Linux)) id 1hqE4U-000222-Nc; Wed, 24 Jul 2019 10:00:30 +0000 Date: Wed, 24 Jul 2019 03:00:30 -0700 From: Christoph Hellwig To: Jia-Ju Bai Cc: rpeterso@redhat.com, agruenba@redhat.com, cluster-devel@redhat.com, linux-kernel@vger.kernel.org Subject: Re: [PATCH] fs: gfs2: Fix a null-pointer dereference in gfs2_alloc_inode() Message-ID: <20190724100030.GA2239@infradead.org> References: <20190724084303.1236-1-baijiaju1990@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190724084303.1236-1-baijiaju1990@gmail.com> User-Agent: Mutt/1.11.4 (2019-03-13) X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jul 24, 2019 at 04:43:03PM +0800, Jia-Ju Bai wrote: > index 0acc5834f653..c07c3f4f8451 100644 > --- a/fs/gfs2/super.c > +++ b/fs/gfs2/super.c > @@ -1728,8 +1728,9 @@ static struct inode *gfs2_alloc_inode(struct super_block *sb) > memset(&ip->i_res, 0, sizeof(ip->i_res)); > RB_CLEAR_NODE(&ip->i_res.rs_node); > ip->i_rahead = 0; > - } > - return &ip->i_inode; > + return &ip->i_inode; > + } else > + return NULL; > } No need for an else after a return. You probably just want to return early for the NULL case.