From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E5367CA9EA0 for ; Fri, 18 Oct 2019 09:35:04 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id B93B921852 for ; Fri, 18 Oct 2019 09:35:04 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="RAcZMOWD" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2392164AbfJRJfD (ORCPT ); Fri, 18 Oct 2019 05:35:03 -0400 Received: from mail-pl1-f196.google.com ([209.85.214.196]:46873 "EHLO mail-pl1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727917AbfJRJfD (ORCPT ); Fri, 18 Oct 2019 05:35:03 -0400 Received: by mail-pl1-f196.google.com with SMTP id q24so2558877plr.13; Fri, 18 Oct 2019 02:35:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=zr8X80FCYGX3NS6q9lz/ERKNDbQdTzcOLi07a/VkvfQ=; b=RAcZMOWD82a0s6I1gcxzhmBdLU4sVZdK3yGz6Jjs25y3EznSN5eVKpll2358Hrj84u APlxx26N4fwfgRJiFJ3sc5LoxBXcNQRTt/vElvG+W7kkosg66YwJWoZkFCz0xTfMvR6f Cbjd+SgRLI8/CUJ1oQ20/w7/U3I+PL006t8sQWvLz38Yc2tf9QieGrjd592HdCGX69Cg 74loV0t60w65irSxdkjPdEWFSMhshoRMFOVGmFBnebKIMvqsp5MvdTjjjRGoCG0iFtiU h1wO5yRg6ve6/4y64whxVgtn/1JdbbSxx2ZSNWTw0Q0U4by3x1tJ6j6655oXad9I+dDE rJ8Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=zr8X80FCYGX3NS6q9lz/ERKNDbQdTzcOLi07a/VkvfQ=; b=sq22LqApW9FEsoqV0aGahv+YquuRg3W1xSqEhhMXOMX5agYTJQNmmFQOdlSDdhCi0I xKbXIpW27Mgev8H7nnuEVMScEK187JYnDnloD/EGGLmvGIHENDBn84SbQYnCzaUPjQIq IqclwSuVIW6ZVyDxBLNE1V1xQVHDJrLZCw3v/DpLqtKEB6QgspTSaXHo0PCc8HQ5ghgA M39wUSHe2JOJsCCxOYx0GkaAo/bvxtBZ/jw+2luwZmS/BFIo0Rt7q/caJDLUbh+JDb5Y jEoDXjyAu4quiWBwNIPImYbVk+mWcIBDm5JQE4hCghXKBkgBu6vb8KNCOrMkAxZuR4xt WD7A== X-Gm-Message-State: APjAAAV13qLqKf5vpAkBg/2jm2C5/5EA5xJf9EPfGZM9svTPWWpNUtFZ 2XVGAxOBXKbUI/p5LVpoiXxi1L5+qASpDRo0nmw= X-Google-Smtp-Source: APXvYqw4nAZfs4DJx1QtvaqZHEiRDgYXllfSaC8wgJ0IuaKqJS3EAvQxq6VuFyH8PluuguPVcRUER8YMtjWt98dTnbE= X-Received: by 2002:a17:902:b110:: with SMTP id q16mr8804423plr.262.1571391302793; Fri, 18 Oct 2019 02:35:02 -0700 (PDT) MIME-Version: 1.0 References: <20191017025058.31528-1-hslester96@gmail.com> In-Reply-To: <20191017025058.31528-1-hslester96@gmail.com> From: Andy Shevchenko Date: Fri, 18 Oct 2019 12:34:52 +0300 Message-ID: Subject: Re: [PATCH] spi: pxa2xx: Add missed security checks To: Chuhong Yuan Cc: Daniel Mack , Haojian Zhuang , Robert Jarzmik , Mark Brown , linux-arm Mailing List , linux-spi , Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Oct 18, 2019 at 8:59 AM Chuhong Yuan wrote: > > pxa2xx_spi_init_pdata misses checks for devm_clk_get and > platform_get_irq. > Add checks for them to fix the bugs. > > Signed-off-by: Chuhong Yuan > --- > drivers/spi/spi-pxa2xx.c | 6 ++++++ > 1 file changed, 6 insertions(+) > > diff --git a/drivers/spi/spi-pxa2xx.c b/drivers/spi/spi-pxa2xx.c > index bb6a14d1ab0f..2e73d75a6ac5 100644 > --- a/drivers/spi/spi-pxa2xx.c > +++ b/drivers/spi/spi-pxa2xx.c > @@ -1565,7 +1565,13 @@ pxa2xx_spi_init_pdata(struct platform_device *pdev) > #endif > > ssp->clk = devm_clk_get(&pdev->dev, NULL); > + if (IS_ERR(ssp->clk)) > + return NULL; > + > ssp->irq = platform_get_irq(pdev, 0); > + if (ssp->irq < 0) > + return NULL; I'm not sure they are mandatory for all platforms. To be on the safe side, you simple need to add _optional() to the both call along with above change. -- With Best Regards, Andy Shevchenko