Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp1970405rwb; Fri, 19 Aug 2022 12:38:40 -0700 (PDT) X-Google-Smtp-Source: AA6agR6yW4kFiFhqHrEGCB9QUJJ3OOdFwWloMgYoDPHnHgFK9rpWzqn9iLPnp7zlWfGbOBm++LDu X-Received: by 2002:a17:90a:e543:b0:1fa:d591:12c4 with SMTP id ei3-20020a17090ae54300b001fad59112c4mr8072239pjb.91.1660937920123; Fri, 19 Aug 2022 12:38:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660937920; cv=none; d=google.com; s=arc-20160816; b=wmCGh07ZB4W1IBUt/XwM9UZAh6x2Q7AM+W0PvC7iyCqZdTNzebj4+mRC4tDGjgwRIu Zv0kosc/vd+n1LAE8q2D0T18QKSsVAnOEsmzIQvgOgZtPb+zZB6pzqxLZlwsQcbZ9SGQ UkMA++2Ueh1p3/c97WExV9EF9aZLXKo3pLNCGk7JB1Jkqfep5n/ehkz16DDHEO4MPKBr Vic4TTlUsGy+CeN7517oOM3pidzCdHajzMIdj9Ztboi1qEAEQZAxYV75+CAIVg4VCuhT PGbUWnqUV+MQ8H01iSVjVMF6vUJUu0cPb7vScxfEaEu+iQSPduph93JcghDte7dgkkji DiPw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=P2SHhcLRQO6Rd6ajFdYShuDAT57xOBBygR+4dhoUxc8=; b=yDbkhiyzUT8IcH3LSBJ/i6LxKhlPFlBveO8JoQFYIX8k3iSjamyZMA7TWz9VzLf/e1 jqrY99usVVvI9zLk/XnMx51bY2DwUPbcf0/X3rLTJfMH/qV5GycN/LzniHgJax5Lp1JF 9MKmIp6tRI/Cp7R+jjolP/xAFSQhuz6nFI594sDY14qleQVuD0UAhv89h7wNglyxXp2J UEP5A4i9hN2cg+slDbODdcJjrIZ7iEqY8ZEIlcT7B3L4c+W42N1b+7v0UtMJAGXpiEOl mGBAuf1lgikrhEKHOCu2Bm3joI02Hvz+ulM/t+PrKRNCY6Lr24GO+NGwyGEI0SVIrKMu Htgg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmx.net header.s=badeba3b8450 header.b=ddTEMirL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=gmx.de Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z198-20020a6333cf000000b0042a37a4b348si3495080pgz.821.2022.08.19.12.38.28; Fri, 19 Aug 2022 12:38:40 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmx.net header.s=badeba3b8450 header.b=ddTEMirL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=gmx.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350510AbiHSTbz (ORCPT + 99 others); Fri, 19 Aug 2022 15:31:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58222 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349705AbiHSTbx (ORCPT ); Fri, 19 Aug 2022 15:31:53 -0400 Received: from mout.gmx.net (mout.gmx.net [212.227.15.15]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1DBA2D758A; Fri, 19 Aug 2022 12:31:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1660937501; bh=S9XSHGciNIn79h/yqTTFzk/eQagf9Lf+whoQDfPRleg=; h=X-UI-Sender-Class:Date:Subject:To:Cc:References:From:In-Reply-To; b=ddTEMirLyv+YLVRKyw3garrKG7yLA0m9QETbymTnuRXz42FyIYLb85j42Zo85+/kN S9sbMhwLECQFi9GzO+5RQpSxfg+yUuxN2wamTJM+gSJyHZz7A825kvEdyC9NhVIFkf ExBad+NNZtRdzeagqTSqDTJIm2W0KK5F343S5Gw0= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from [192.168.20.60] ([92.116.153.160]) by mail.gmx.net (mrgmx005 [212.227.17.190]) with ESMTPSA (Nemesis) id 1MWASe-1nrV6l0H98-00XeEg; Fri, 19 Aug 2022 21:31:41 +0200 Message-ID: <9ad5cdb5-3f72-1305-b509-d0f68943b618@gmx.de> Date: Fri, 19 Aug 2022 21:30:40 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.12.0 Subject: Re: [PATCH] parisc: handle failure of kmalloc in ccio_init_resources Content-Language: en-US To: Li Qiong , "James E . J . Bottomley" Cc: linux-parisc@vger.kernel.org, linux-kernel@vger.kernel.org, yuzhe References: <20220819041510.75473-1-liqiong@nfschina.com> From: Helge Deller In-Reply-To: <20220819041510.75473-1-liqiong@nfschina.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Provags-ID: V03:K1:KitrQKEzV9hFGl+PSdcnzshEw9jqQ8aecACCnOxaKzzfryANmcV IIh9BCpQMmEdWxnZ4cKAbzpyiSGJ61Zt3xTfK5mXU432DhfbIaiKzWnicD3a7Ji3CbPPrEX iBol1CIKhH+t8gW6LepnhCpThbfVOIejVfjc3+c6OeGO0HNtQetIWbuSJouLdtkmFh7PWbB vwRvEGmFZrI6THBXz/eDQ== X-UI-Out-Filterresults: notjunk:1;V03:K0:z8UfPHmWJ5o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ptDD9PYsiXxDLOwM4HQ8CAsWqtutJCpY0epOlED J+M1+bOqgotA3//10TvYg4FEADmBiJWeo5EqYLhecCzagWR56YzE2qynA== X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,FREEMAIL_FROM,NICE_REPLY_A,RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 8/19/22 06:15, Li Qiong wrote: > As the possible failure of the kmalloc(), it should be better > to fix this error path, check and return '-ENOMEM' error code. > > Signed-off-by: Li Qiong applied. Thanks! Helge > --- > drivers/parisc/ccio-dma.c | 11 ++++++++--- > 1 file changed, 8 insertions(+), 3 deletions(-) > > diff --git a/drivers/parisc/ccio-dma.c b/drivers/parisc/ccio-dma.c > index 9be007c9420f..f69ab90b5e22 100644 > --- a/drivers/parisc/ccio-dma.c > +++ b/drivers/parisc/ccio-dma.c > @@ -1380,15 +1380,17 @@ ccio_init_resource(struct resource *res, char *n= ame, void __iomem *ioaddr) > } > } > > -static void __init ccio_init_resources(struct ioc *ioc) > +static int __init ccio_init_resources(struct ioc *ioc) > { > struct resource *res =3D ioc->mmio_region; > char *name =3D kmalloc(14, GFP_KERNEL); > - > + if (unlikely(!name)) > + return -ENOMEM; > snprintf(name, 14, "GSC Bus [%d/]", ioc->hw_path); > > ccio_init_resource(res, name, &ioc->ioc_regs->io_io_low); > ccio_init_resource(res + 1, name, &ioc->ioc_regs->io_io_low_hv); > + return 0; > } > > static int new_ioc_area(struct resource *res, unsigned long size, > @@ -1543,7 +1545,10 @@ static int __init ccio_probe(struct parisc_device= *dev) > return -ENOMEM; > } > ccio_ioc_init(ioc); > - ccio_init_resources(ioc); > + if (ccio_init_resources(ioc)) { > + kfree(ioc); > + return -ENOMEM; > + } > hppa_dma_ops =3D &ccio_ops; > > hba =3D kzalloc(sizeof(*hba), GFP_KERNEL);